xref: /DADK/.github/workflows/rust.yml (revision 86f923e00ac1be1dec1f3995e5ea2fa7d0a6ccf8)
1name: Rust
2
3on:
4  push:
5    branches: [ "main" ]
6  pull_request:
7    branches: [ "main" ]
8
9env:
10  CARGO_TERM_COLOR: always
11
12jobs:
13  build:
14
15    runs-on: ubuntu-latest
16
17    steps:
18    - uses: actions/checkout@v3
19    - name: Build
20      run: cargo build --verbose
21    - name: Run tests
22      run: cargo test --verbose
23
24  fmt:
25    runs-on: ubuntu-latest
26    steps:
27    - uses: actions/checkout@v3
28
29    - name: Check formatting
30      run: cargo fmt --check
31
32  test:
33    runs-on: ubuntu-latest
34    env:
35      CARGO_TERM_COLOR: always
36    steps:
37      - uses: actions/checkout@v4
38      - name: Install Rust
39        run: rustup update stable
40      - name: Install cargo-llvm-cov
41        uses: taiki-e/install-action@cargo-llvm-cov
42      - name: Generate code coverage
43        run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
44      - name: Upload coverage to Codecov
45        uses: codecov/codecov-action@v4.0.1
46        with:
47          token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
48          files: lcov.info
49          fail_ci_if_error: true
50
51