Rust CI #193
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
| # Inspired by: | |
| # systemd/zram-generator CI - https://github.com/systemd/zram-generator/blob/main/.github/workflows/ci.yml | |
| # aufover/aufover-benchmark CI - https://github.com/aufover/aufover-benchmark/blob/main/.github/workflows/fedora.yml | |
| --- | |
| name: Rust CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: [ main ] | |
| # Every Monday at 04:00 AM | |
| schedule: | |
| - cron: 0 4 * * 1 | |
| env: | |
| CARGO_TERM_COLOR: always | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: "[ Fedora ${{ matrix.fedora }} ] - Cargo Test ${{ matrix.coverage == true && '& Coverage ' || '' }}(rust ${{ matrix.rust }})" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| rust: [ stable, beta ] | |
| fedora: [ 42, rawhide ] | |
| runs-on: ubuntu-latest | |
| container: | |
| image: fedora:${{ matrix.fedora }} | |
| # Docker seccomp policy incompatible with glibc 2.34 | |
| # https://github.com/actions/runner-images/issues/3812 | |
| options: --security-opt seccomp=unconfined | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install rust ${{ matrix.rust }} | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| override: true | |
| profile: minimal | |
| - name: Install libudev and umockdev devel packages | |
| # required to be able to build rust packages: Development Tools | |
| # https://trendoceans.com/fix-linker-cc-not-found/ | |
| # required by prefixdevname: libudev-devel umockdev-devel | |
| run: | | |
| sudo dnf group install -y c-development | |
| sudo dnf install -y \ | |
| libudev-devel \ | |
| umockdev-devel | |
| - name: Test | |
| if: ${{ matrix.coverage != true }} | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: test | |
| args: --all-features --no-fail-fast | |
| rustfmt: | |
| name: Cargo Fmt | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install latest stable rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| profile: minimal | |
| components: rustfmt | |
| - name: Check format | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: fmt | |
| args: -- --check | |
| clippy: | |
| name: Cargo Clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install latest nightly rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: nightly | |
| override: true | |
| profile: minimal | |
| components: clippy | |
| - name: Update package cache | |
| run: sudo apt-get update | |
| - name: Install libudev devel package | |
| run: sudo apt-get install -y libudev-dev | |
| - name: Run Clippy | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: clippy | |
| args: -- --no-deps | |
| ... |