Skip to content

Merge pull request #56 from rodneylab/ci__update_ci_config #78

Merge pull request #56 from rodneylab/ci__update_ci_config

Merge pull request #56 from rodneylab/ci__update_ci_config #78

Workflow file for this run

name: Rust
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
permissions: read-all
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings -Cinstrument-coverage"
LLVM_PROFILE_FILE: "project-%p-%m.profraw"
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
disable-telemetry: true
- name: Install Linux Dependencies
run: sudo apt-get update && sudo apt-get install pkg-config libx11-dev libxi-dev libgl1-mesa-dev libasound2-dev
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: dtolnay/rust-toolchain@4f366e621dc8fa63f557ca04b8f4361824a35a45 # stable
- name: Run tests
run: cargo test
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
disable-telemetry: true
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: dtolnay/rust-toolchain@4f366e621dc8fa63f557ca04b8f4361824a35a45 # stable
with:
components: rustfmt
- name: Enforce formatting
run: cargo fmt --check
fmt-dprint:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: dprint/check@2f1cf31537886c3bfb05591c031f7744e48ba8a1 # v2.2
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
disable-telemetry: true
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: dtolnay/rust-toolchain@4f366e621dc8fa63f557ca04b8f4361824a35a45 # stable
with:
components: clippy
- name: Linting
run: cargo clippy -- -D warnings
msrv:
runs-on: ubuntu-latest
strategy:
matrix:
msrv: ["1.73.0"]
name: ubuntu / ${{ matrix.msrv }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Install Linux Dependencies
run: sudo apt-get update && sudo apt-get install pkg-config libx11-dev libxi-dev libgl1-mesa-dev libasound2-dev
- name: Install ${{ matrix.msrv }}
uses: dtolnay/rust-toolchain@4f366e621dc8fa63f557ca04b8f4361824a35a45 # stable
with:
toolchain: ${{ matrix.msrv }}
- name: cargo +${{ matrix.msrv }} check
run: cargo check
coverage:
name: Code coverage
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
disable-telemetry: true
- name: Install Linux Dependencies
run: sudo apt-get update && sudo apt-get install pkg-config libx11-dev libxi-dev libgl1-mesa-dev libasound2-dev
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: dtolnay/rust-toolchain@4f366e621dc8fa63f557ca04b8f4361824a35a45 # stable
with:
components: llvm-tools-preview
- name: Install grcov
run: cargo install grcov
- name: Build
run: cargo build
- name: Run tests
run: cargo test
- name: Generate code coverage
run: grcov . -s . --binary-path ./target/debug/ -t lcov --branch --ignore-not-existing -o ./target/debug/
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
file: ./target/debug/lcov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}