name: CI on: workflow_dispatch: push: tags: ['v*'] pull_request: branches: [main] env: CARGO_TERM_COLOR: always concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build: strategy: fail-fast: false matrix: include: - os: ubuntu-latest target: x86_64-unknown-linux-gnu artifact: cagire-linux-x86_64 - os: macos-15-intel target: x86_64-apple-darwin artifact: cagire-macos-x86_64 - os: macos-14 target: aarch64-apple-darwin artifact: cagire-macos-aarch64 - os: windows-latest target: x86_64-pc-windows-msvc artifact: cagire-windows-x86_64 runs-on: ${{ matrix.os }} timeout-minutes: 30 steps: - uses: actions/checkout@v4 with: submodules: recursive - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} components: clippy - name: Cache Rust dependencies uses: Swatinem/rust-cache@v2 with: key: ${{ matrix.target }} - name: Install dependencies (Linux) if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install -y build-essential cmake pkg-config libasound2-dev libclang-dev libjack-dev \ libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev libgl1-mesa-dev cargo install cargo-bundle - name: Install dependencies (macOS) if: runner.os == 'macOS' run: | brew list cmake &>/dev/null || brew install cmake cargo install cargo-bundle - name: Install dependencies (Windows) if: runner.os == 'Windows' run: | choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' echo "C:\Program Files\CMake\bin" >> $env:GITHUB_PATH cargo install cargo-bundle - name: Build run: cargo build --release --target ${{ matrix.target }} - name: Build desktop run: cargo build --release --features desktop --bin cagire-desktop --target ${{ matrix.target }} - name: Bundle desktop app run: cargo bundle --release --features desktop --bin cagire-desktop --target ${{ matrix.target }} - name: Run tests run: cargo test --target ${{ matrix.target }} - name: Run clippy run: cargo clippy --target ${{ matrix.target }} -- -D warnings - name: Upload artifact (Unix) if: runner.os != 'Windows' uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact }} path: target/${{ matrix.target }}/release/cagire - name: Upload artifact (Windows) if: runner.os == 'Windows' uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact }} path: target/${{ matrix.target }}/release/cagire.exe - name: Upload desktop artifact (Linux deb) if: runner.os == 'Linux' uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact }}-desktop path: target/${{ matrix.target }}/release/bundle/deb/*.deb - name: Upload desktop artifact (macOS app bundle) if: runner.os == 'macOS' uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact }}-desktop path: target/${{ matrix.target }}/release/bundle/osx/Cagire.app - name: Upload desktop artifact (Windows MSI) if: runner.os == 'Windows' uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact }}-desktop path: target/${{ matrix.target }}/release/bundle/msi/*.msi release: needs: build if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest timeout-minutes: 10 permissions: contents: write steps: - name: Download all artifacts uses: actions/download-artifact@v4 with: path: artifacts - name: Prepare release files run: | mkdir -p release for dir in artifacts/*/; do name=$(basename "$dir") if [[ "$name" == *-desktop ]]; then base="${name%-desktop}" if ls "$dir"/*.msi 1>/dev/null 2>&1; then cp "$dir"/*.msi "release/${base}-desktop.msi" elif ls "$dir"/*.deb 1>/dev/null 2>&1; then cp "$dir"/*.deb "release/${base}-desktop.deb" elif [ -d "$dir/Cagire.app" ]; then (cd "$dir" && zip -r "../../release/${base}-desktop.app.zip" Cagire.app) fi else if [ -f "$dir/cagire.exe" ]; then cp "$dir/cagire.exe" "release/${name}.exe" elif [ -f "$dir/cagire" ]; then cp "$dir/cagire" "release/${name}" fi fi done - name: Create Release uses: softprops/action-gh-release@v2 with: files: release/* generate_release_notes: true