xref: /libCEED/.github/workflows/rust-test-with-style.yml (revision 4fee36f0a30516a0b5ad51bf7eb3b32d83efd623)
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        components: llvm-tools-preview
24    - name: Install cargo-llvm-cov
25      uses: taiki-e/install-action@v2
26      with:
27        tool: cargo-llvm-cov
28    - name: Rust test with coverage
29      env:
30        CC: ${{ matrix.compiler }}
31        FC: gfortran-11
32      run: cargo llvm-cov test --doctests --lcov --output-path lcov.info
33    - name: Codecov upload
34      uses: codecov/codecov-action@v3
35      with:
36        files: lcov.info
37        token: ${{secrets.CODECOV_TOKEN}}
38
39  style:
40    strategy:
41      matrix:
42        os: [ubuntu-22.04]
43        compiler: [clang]
44
45    runs-on: ${{ matrix.os }}
46
47    steps:
48    - name: Environment setup
49      uses: actions/checkout@v3
50    - name: Rust setup
51      uses: dtolnay/rust-toolchain@master
52      with:
53        # Note: rustfmt not always included in nightly, will attempt to downgrade until rustfmt found
54        toolchain: nightly
55        components: rustfmt
56    - name: Rust style
57      run: |
58        cargo +nightly fmt --version
59        cargo +nightly fmt -- --check
60