Merge pull request #563 from kdash-rs/dependabot/cargo/serde-saphyr-1… #1134
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
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| name: Continuous Integration | |
| jobs: | |
| # Workaround for making Github Actions skip based on commit message `[skip ci]` | |
| # Source https://gist.github.com/ybiquitous/c80f15c18319c63cae8447a3be341267 | |
| prepare: | |
| runs-on: ubuntu-latest | |
| if: | | |
| !contains(format('{0} {1} {2}', github.event.head_commit.message, github.event.pull_request.title, github.event.pull_request.body), '[skip ci]') | |
| steps: | |
| - run: | | |
| cat <<'MESSAGE' | |
| github.event_name: ${{ toJson(github.event_name) }} | |
| github.event: | |
| ${{ toJson(github.event) }} | |
| MESSAGE | |
| check: | |
| name: Check | |
| runs-on: ubuntu-latest | |
| needs: prepare | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v3 | |
| name: Cache Cargo registry | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }} | |
| - uses: dtolnay/rust-toolchain@stable | |
| name: Set Rust toolchain | |
| - run: cargo check --all --all-targets --workspace | |
| test: | |
| name: Test Suite | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - "macOS-latest" | |
| - "windows-latest" | |
| - "ubuntu-latest" | |
| rust: [stable, nightly] | |
| needs: prepare | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v3 | |
| name: Cache Cargo registry | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }} | |
| - uses: dtolnay/rust-toolchain@master | |
| name: Set Rust toolchain | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| components: rustc, rust-std, cargo, llvm-tools, llvm-tools-preview | |
| - run: cargo clean | |
| if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly' | |
| - run: mkdir -p ./target/debug/coverage | |
| if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly' | |
| - run: cargo install grcov | |
| if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly' | |
| - name: cargo test nightly | |
| run: cargo test --all-features | |
| if: matrix.rust == 'nightly' | |
| env: | |
| CARGO_INCREMENTAL: "0" | |
| LLVM_PROFILE_FILE: 'target/debug/coverage/dcaf-%p-%m.profraw' | |
| RUSTFLAGS: '-Cinstrument-coverage -Cpanic=abort -Zpanic_abort_tests' | |
| RUSTDOCFLAGS: '-C instrument-coverage -Cpanic=abort -Zpanic_abort_tests -Z unstable-options --persist-doctests target/debug/' | |
| - run: zip ./target/debug/coverage/files.zip ./target/debug/coverage/dcaf-*.profraw | |
| if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly' | |
| - name: cargo test stable | |
| run: cargo test --all --all-features --all-targets --workspace | |
| if: matrix.rust == 'stable' | |
| - id: coverage | |
| if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly' | |
| run: | | |
| grcov ./target/debug/coverage/files.zip -s . --binary-path ./target/debug/ --service-job-id ${{ github.job }} --service-name 'Continuous Integration' --commit-sha ${{ github.sha }} -o ./target/debug/coverage/ --branch --ignore-not-existing --llvm --filter covered --ignore '/*' --ignore 'C:/*' --ignore '../*' -t coveralls | |
| - name: Push grcov results to Coveralls | |
| if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly' | |
| uses: coverallsapp/github-action@v2 | |
| # Coverage reporting is informational; a Coveralls outage must not fail CI. | |
| continue-on-error: true | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| file: ./target/debug/coverage/coveralls | |
| fmt: | |
| name: Rustfmt | |
| runs-on: ubuntu-latest | |
| needs: prepare | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v3 | |
| name: Cache Cargo registry | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }} | |
| - uses: dtolnay/rust-toolchain@stable | |
| name: Set Rust toolchain | |
| with: | |
| components: rustfmt | |
| - run: cargo fmt --all -- --check | |
| clippy: | |
| name: Clippy | |
| runs-on: ubuntu-latest | |
| needs: prepare | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v3 | |
| name: Cache Cargo registry | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }} | |
| - uses: dtolnay/rust-toolchain@stable | |
| name: Set Rust toolchain | |
| with: | |
| components: clippy | |
| - run: cargo clippy --all --all-features --all-targets --workspace -- -D warnings | |
| env: | |
| CARGO_INCREMENTAL: "0" | |
| packaging: | |
| name: Packaging scripts | |
| runs-on: ubuntu-latest | |
| needs: prepare | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install shellcheck + bats | |
| run: sudo apt-get update && sudo apt-get install -y shellcheck bats | |
| - name: Lint install.sh | |
| run: shellcheck scripts/install.sh | |
| - name: Test install.sh (bats) | |
| run: bats scripts/install.test.bats | |
| - name: AUR packager unit tests | |
| run: python3 deployment/aur/packager_test.py |