xref: /libCEED/.github/workflows/rust-test-with-style.yml (revision d310b3d31eeeddd20725517a3a61881a36d919f0)
1name: Rust
2
3on:
4  push:
5
6jobs:
7  test:
8    strategy:
9      matrix:
10        os: [ubuntu-22.04]
11        compiler: [clang]
12
13    runs-on: ${{ matrix.os }}
14
15    steps:
16    - name: Environment setup
17      uses: actions/checkout@v3
18    - name: Rust setup
19      uses: dtolnay/rust-toolchain@master
20      with:
21        # Note: nightly required for coverage of Doctests
22        toolchain: nightly
23    - name: Install cargo-llvm-cov
24      uses: taiki-e/install-action@cargo-llvm-cov
25    - name: Rust test with coverage
26      env:
27        CC: ${{ matrix.compiler }}
28        FC: gfortran-11
29      run: cargo llvm-cov test --doctests --lcov --output-path lcov.info
30    - name: Codecov upload
31      uses: codecov/codecov-action@v3
32      with:
33        files: lcov.info
34        token: ${{secrets.CODECOV_TOKEN}}
35
36  style:
37    strategy:
38      matrix:
39        os: [ubuntu-22.04]
40        compiler: [clang]
41
42    runs-on: ${{ matrix.os }}
43
44    steps:
45    - name: Environment setup
46      uses: actions/checkout@v3
47    - name: Rust setup
48      uses: dtolnay/rust-toolchain@master
49      with:
50        # Note: rustfmt not always included in nightly, will attempt to downgrade until rustfmt found
51        toolchain: nightly
52        components: rustfmt
53    - name: Rust style
54      run: |
55        cargo +nightly fmt --version
56        cargo +nightly fmt -- --check
57