xref: /libCEED/.github/workflows/rust-test-with-style.yml (revision 22785960d60f45e0c65c47523fd8ab76bf9537ed)
1name: Rust
2
3on:
4  push:
5
6jobs:
7  test:
8    strategy:
9      matrix:
10        os: [ubuntu-20.04]
11        compiler: [clang]
12
13    runs-on: ${{ matrix.os }}
14
15    steps:
16    - name: Environment setup
17      uses: actions/checkout@v2
18    - name: Rust setup
19      uses: actions-rs/toolchain@v1
20      with:
21        # Note: nightly required for coverage of Doctests with tarpaulin
22        toolchain: nightly
23        override: true
24    - name: Rust test with coverage
25      uses: actions-rs/tarpaulin@v0.1
26      env:
27        CC: ${{ matrix.compiler }}
28        FC: gfortran-9
29      with:
30        args: '--run-types Doctests Tests --exclude-files backends/* gallery/* include/* interface/*'
31    - name: Codecov upload
32      uses: codecov/codecov-action@v1.0.2
33      with:
34        directory: target/tarpaulin
35        token: ${{secrets.CODECOV_TOKEN}}
36
37  style:
38    strategy:
39      matrix:
40        os: [ubuntu-20.04]
41        compiler: [clang]
42
43    runs-on: ${{ matrix.os }}
44
45    steps:
46    - name: Environment setup
47      uses: actions/checkout@v2
48    - name: Rust setup
49      uses: actions-rs/toolchain@v1
50      with:
51        # Note: rustfmt not always included in nightly, will attempt to downgrade until rustfmt found
52        toolchain: nightly
53        components: rustfmt
54    - name: Rust style
55      run: |
56        cargo +nightly fmt --version
57        cargo +nightly fmt -- --check
58