Merge pull request #43 from FreddyFunk/feature/license-file #62
This file contains hidden or 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: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| build_aarch64_flatpak: | |
| description: 'Build aarch64 Flatpak (slow, ~6 hours with QEMU)' | |
| required: false | |
| default: false | |
| type: boolean | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| check: | |
| name: Check & Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-tags: true | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| components: rustfmt, clippy | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| pkg-config \ | |
| libglib2.0-dev \ | |
| libgstreamer1.0-dev \ | |
| libgstreamer-plugins-base1.0-dev \ | |
| libgstreamer-plugins-bad1.0-dev \ | |
| gstreamer1.0-plugins-base \ | |
| gstreamer1.0-plugins-good \ | |
| gstreamer1.0-plugins-bad \ | |
| gstreamer1.0-plugins-ugly \ | |
| gstreamer1.0-libav \ | |
| libwayland-dev \ | |
| libxkbcommon-dev \ | |
| libinput-dev \ | |
| libudev-dev \ | |
| libseat-dev | |
| - name: Install just | |
| uses: extractions/setup-just@v2 | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Check formatting | |
| run: just fmt-check | |
| - name: Run cargo check | |
| run: just cargo-check | |
| - name: Run tests | |
| run: just test | |
| # Cross-compiled debug builds to verify compilation on all target architectures | |
| # x86_64 and aarch64 always run; riscv64 runs on main or manual trigger | |
| build-x86_64: | |
| name: Build (x86_64) | |
| runs-on: ubuntu-latest | |
| needs: check | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-tags: true | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| targets: x86_64-unknown-linux-gnu | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| pkg-config \ | |
| libglib2.0-dev \ | |
| libgstreamer1.0-dev \ | |
| libgstreamer-plugins-base1.0-dev \ | |
| libgstreamer-plugins-bad1.0-dev \ | |
| libwayland-dev \ | |
| libxkbcommon-dev \ | |
| libinput-dev \ | |
| libudev-dev \ | |
| libseat-dev | |
| - name: Build debug binary | |
| run: cargo build --target x86_64-unknown-linux-gnu | |
| build-aarch64: | |
| name: Build (aarch64) | |
| runs-on: ubuntu-latest | |
| needs: check | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-tags: true | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| targets: aarch64-unknown-linux-gnu | |
| - name: Install cross | |
| run: cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Build debug binary | |
| run: cross build --target aarch64-unknown-linux-gnu | |
| build-riscv64: | |
| name: Build (riscv64) | |
| runs-on: ubuntu-latest | |
| needs: check | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-tags: true | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| targets: riscv64gc-unknown-linux-gnu | |
| - name: Install cross | |
| run: cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Build debug binary | |
| run: cross build --target riscv64gc-unknown-linux-gnu | |
| flatpak-x86_64: | |
| name: Flatpak (x86_64) | |
| runs-on: ubuntu-latest | |
| needs: check | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-tags: true | |
| - name: Install Flatpak and flatpak-builder | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y flatpak flatpak-builder | |
| - name: Add Flathub remote | |
| run: | | |
| sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo | |
| - name: Install Flatpak SDK and runtime | |
| run: | | |
| sudo flatpak install -y --noninteractive flathub org.freedesktop.Platform//25.08 --arch=x86_64 | |
| sudo flatpak install -y --noninteractive flathub org.freedesktop.Sdk//25.08 --arch=x86_64 | |
| sudo flatpak install -y --noninteractive flathub org.freedesktop.Sdk.Extension.rust-stable//25.08 --arch=x86_64 | |
| sudo flatpak install -y --noninteractive flathub com.system76.Cosmic.BaseApp//stable --arch=x86_64 | |
| - name: Install just | |
| uses: extractions/setup-just@v2 | |
| - name: Install Python dependencies for cargo-sources generator | |
| run: | | |
| pip install aiohttp toml tomlkit | |
| - name: Build Flatpak bundle | |
| run: just flatpak-bundle-arch x86_64 | |
| - name: Upload Flatpak bundle | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cosmic-camera-x86_64.flatpak | |
| path: cosmic-camera-x86_64.flatpak | |
| if-no-files-found: error | |
| retention-days: 7 | |
| flatpak-aarch64: | |
| name: Flatpak (aarch64) | |
| runs-on: ubuntu-latest | |
| needs: check | |
| # Run on push to main, or on manual trigger with build_aarch64_flatpak=true | |
| if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.build_aarch64_flatpak) | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-tags: true | |
| - name: Install Flatpak and flatpak-builder | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y flatpak flatpak-builder | |
| - name: Set up QEMU for multi-arch builds | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: arm64 | |
| - name: Add Flathub remote | |
| run: | | |
| sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo | |
| - name: Install Flatpak SDK and runtime | |
| run: | | |
| sudo flatpak install -y --noninteractive flathub org.freedesktop.Platform//25.08 --arch=aarch64 | |
| sudo flatpak install -y --noninteractive flathub org.freedesktop.Sdk//25.08 --arch=aarch64 | |
| sudo flatpak install -y --noninteractive flathub org.freedesktop.Sdk.Extension.rust-stable//25.08 --arch=aarch64 | |
| sudo flatpak install -y --noninteractive flathub com.system76.Cosmic.BaseApp//stable --arch=aarch64 | |
| - name: Install just | |
| uses: extractions/setup-just@v2 | |
| - name: Install Python dependencies for cargo-sources generator | |
| run: | | |
| pip install aiohttp toml tomlkit | |
| - name: Build Flatpak bundle | |
| run: just flatpak-bundle-arch aarch64 | |
| - name: Upload Flatpak bundle | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cosmic-camera-aarch64.flatpak | |
| path: cosmic-camera-aarch64.flatpak | |
| if-no-files-found: error | |
| retention-days: 7 |