xref: /libCEED/.github/workflows/rust-test-with-style.yml (revision b1c579f084fff6512b7ecdc5f1776714eaea68ae)
18a4ce0d7SJeremy L Thompsonname: Rust
28a4ce0d7SJeremy L Thompson
38a4ce0d7SJeremy L Thompsonon:
48a4ce0d7SJeremy L Thompson  push:
5dcd9f19cSJeremy L Thompson    branches:
6dcd9f19cSJeremy L Thompson      - main
7dcd9f19cSJeremy L Thompson  pull_request:
88a4ce0d7SJeremy L Thompson
98a4ce0d7SJeremy L Thompsonjobs:
108a4ce0d7SJeremy L Thompson  test:
118a4ce0d7SJeremy L Thompson    strategy:
128a4ce0d7SJeremy L Thompson      matrix:
13*bdee0278SJeremy L Thompson        os: [ubuntu-24.04, macos-15]
14db34a149Sjeremylt        compiler: [clang]
15ded9b81dSJeremy L Thompson
16ded9b81dSJeremy L Thompson    runs-on: ${{ matrix.os }}
17ded9b81dSJeremy L Thompson
18ded9b81dSJeremy L Thompson    steps:
19ded9b81dSJeremy L Thompson    - name: Environment setup
20e735508cSJeremy L Thompson      uses: actions/checkout@v4
21ded9b81dSJeremy L Thompson    - name: Rust setup
22ba20f131SJed Brown      uses: dtolnay/rust-toolchain@master
23ded9b81dSJeremy L Thompson      with:
24751b7b16SJed Brown        # Note: nightly required for coverage of Doctests
25ded9b81dSJeremy L Thompson        toolchain: nightly
26b34efc53SJed Brown        components: llvm-tools-preview
27751b7b16SJed Brown    - name: Install cargo-llvm-cov
28b34efc53SJed Brown      uses: taiki-e/install-action@v2
29b34efc53SJed Brown      with:
30d0a36517SJed Brown        tool: cargo-llvm-cov
31ded9b81dSJeremy L Thompson    - name: Rust test with coverage
32ded9b81dSJeremy L Thompson      env:
33ded9b81dSJeremy L Thompson        CC: ${{ matrix.compiler }}
34ed1ebff7SJeremy L Thompson        FC: gfortran
35751b7b16SJed Brown      run: cargo llvm-cov test --doctests --lcov --output-path lcov.info
36ded9b81dSJeremy L Thompson    - name: Codecov upload
37e735508cSJeremy L Thompson      uses: codecov/codecov-action@v4
38ded9b81dSJeremy L Thompson      with:
39751b7b16SJed Brown        files: lcov.info
40ded9b81dSJeremy L Thompson        token: ${{secrets.CODECOV_TOKEN}}
41ded9b81dSJeremy L Thompson
42ded9b81dSJeremy L Thompson  style:
43ded9b81dSJeremy L Thompson    strategy:
44ded9b81dSJeremy L Thompson      matrix:
45d83cf49fSJeremy L Thompson        os: [ubuntu-24.04]
46db34a149Sjeremylt        compiler: [clang]
478a4ce0d7SJeremy L Thompson
488a4ce0d7SJeremy L Thompson    runs-on: ${{ matrix.os }}
498a4ce0d7SJeremy L Thompson
508a4ce0d7SJeremy L Thompson    steps:
518a4ce0d7SJeremy L Thompson    - name: Environment setup
52e735508cSJeremy L Thompson      uses: actions/checkout@v4
538a4ce0d7SJeremy L Thompson    - name: Rust setup
54ba20f131SJed Brown      uses: dtolnay/rust-toolchain@master
558a4ce0d7SJeremy L Thompson      with:
562ac872feSjeremylt        # Note: rustfmt not always included in nightly, will attempt to downgrade until rustfmt found
572ac872feSjeremylt        toolchain: nightly
582ac872feSjeremylt        components: rustfmt
598a4ce0d7SJeremy L Thompson    - name: Rust style
608a4ce0d7SJeremy L Thompson      run: |
612ac872feSjeremylt        cargo +nightly fmt --version
622ac872feSjeremylt        cargo +nightly fmt -- --check
63