CI #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: workflow_dispatch | |
env: | |
binary: lapis | |
CARGO_TERM_COLOR: always | |
use_git_lfs: false | |
jobs: | |
# Build for Linux | |
build-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: ${{ env.use_git_lfs }} | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: x86_64-unknown-linux-gnu | |
- name: install dependencies | |
run: | | |
sudo apt-get update; sudo apt-get install libjack-dev | |
- name: Build | |
run: | | |
cargo build --release --target x86_64-unknown-linux-gnu | |
- name: Prepare package | |
run: | | |
mkdir linux | |
cp target/x86_64-unknown-linux-gnu/release/${{ env.binary }} linux/ | |
- name: Package as a zip | |
working-directory: ./linux | |
run: | | |
zip --recurse-paths ../${{ env.binary }}.zip . | |
- name: Upload binaries to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ env.binary }}.zip | |
name: linux | |
retention-days: 30 | |
# Build for Windows | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: ${{ env.use_git_lfs }} | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: x86_64-pc-windows-msvc | |
- name: Build | |
run: | | |
cargo build --release --target x86_64-pc-windows-msvc | |
- name: Prepare package | |
run: | | |
mkdir windows | |
cp target/x86_64-pc-windows-msvc/release/${{ env.binary }}.exe windows/ | |
- name: Package as a zip | |
run: | | |
Compress-Archive -Path windows/* -DestinationPath ${{ env.binary }}.zip | |
- name: Upload binaries to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ env.binary }}.zip | |
name: windows | |
retention-days: 30 | |
# Build for MacOS x86_64 | |
build-macOS-intel: | |
runs-on: macOS-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: ${{ env.use_git_lfs }} | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: x86_64-apple-darwin | |
- name: Environment Setup | |
run: | | |
export CFLAGS="-fno-stack-check" | |
export MACOSX_DEPLOYMENT_TARGET="10.9" | |
- name: Build | |
run: | | |
cargo build --release --target x86_64-apple-darwin | |
- name: Prepare Package | |
run: | | |
mkdir -p ${{ env.binary }}.app/Contents/MacOS | |
cp target/x86_64-apple-darwin/release/${{ env.binary }} ${{ env.binary }}.app/Contents/MacOS/ | |
hdiutil create -fs HFS+ -volname "${{ env.binary }}" -srcfolder ${{ env.binary }}.app ${{ env.binary }}-macOS-intel.dmg | |
- name: Upload binaries to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ env.binary }}-macOS-intel.dmg | |
name: macOS-intel | |
retention-days: 30 | |
# Build for MacOS Apple Silicon | |
build-macOS-apple-silicon: | |
runs-on: macOS-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: ${{ env.use_git_lfs }} | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: aarch64-apple-darwin | |
- name: Environment | |
# macOS 11 was the first version to support ARM | |
run: | | |
export MACOSX_DEPLOYMENT_TARGET="11" | |
- name: Build | |
run: | | |
cargo build --release --target aarch64-apple-darwin | |
- name: Prepare Package | |
run: | | |
mkdir -p ${{ env.binary }}.app/Contents/MacOS | |
cp target/aarch64-apple-darwin/release/${{ env.binary }} ${{ env.binary }}.app/Contents/MacOS/ | |
hdiutil create -fs HFS+ -volname "${{ env.binary }}-macOS-apple-silicon" -srcfolder ${{ env.binary }}.app ${{ env.binary }}-macOS-apple-silicon.dmg | |
- name: Upload binaries to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ env.binary }}-macOS-apple-silicon.dmg | |
name: macOS-apple-silicon | |
retention-days: 30 |