xref: /libCEED/.github/workflows/rust-test-with-style.yml (revision 6857ae02ac3824f2069df9eaa9cbf65cdbf9d502)
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 with tarpaulin
22        toolchain: nightly
23    - name: Rust test with coverage
24      uses: actions-rs/tarpaulin@v0.1
25      env:
26        CC: ${{ matrix.compiler }}
27        FC: gfortran-11
28      with:
29        args: '--run-types Doctests Tests --exclude-files backends/* gallery/* include/* interface/* --out Xml'
30    - name: Codecov upload
31      uses: codecov/codecov-action@v3
32      with:
33        files: ./cobertura.xml
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