xref: /libCEED/.github/workflows/rust-test-with-style.yml (revision 751b7b16b4c6f23d06daa251e4825bc6151d97db)
18a4ce0d7SJeremy L Thompsonname: Rust
28a4ce0d7SJeremy L Thompson
38a4ce0d7SJeremy L Thompsonon:
48a4ce0d7SJeremy L Thompson  push:
58a4ce0d7SJeremy L Thompson
68a4ce0d7SJeremy L Thompsonjobs:
78a4ce0d7SJeremy L Thompson  test:
88a4ce0d7SJeremy L Thompson    strategy:
98a4ce0d7SJeremy L Thompson      matrix:
106c0547c1SJeremy L Thompson        os: [ubuntu-22.04]
11db34a149Sjeremylt        compiler: [clang]
12ded9b81dSJeremy L Thompson
13ded9b81dSJeremy L Thompson    runs-on: ${{ matrix.os }}
14ded9b81dSJeremy L Thompson
15ded9b81dSJeremy L Thompson    steps:
16ded9b81dSJeremy L Thompson    - name: Environment setup
17ba20f131SJed Brown      uses: actions/checkout@v3
18ded9b81dSJeremy L Thompson    - name: Rust setup
19ba20f131SJed Brown      uses: dtolnay/rust-toolchain@master
20ded9b81dSJeremy L Thompson      with:
21*751b7b16SJed Brown        # Note: nightly required for coverage of Doctests
22ded9b81dSJeremy L Thompson        toolchain: nightly
23*751b7b16SJed Brown    - name: Install cargo-llvm-cov
24*751b7b16SJed Brown      uses: taiki-e/install-action@cargo-llvm-cov
25ded9b81dSJeremy L Thompson    - name: Rust test with coverage
26ded9b81dSJeremy L Thompson      env:
27ded9b81dSJeremy L Thompson        CC: ${{ matrix.compiler }}
286c0547c1SJeremy L Thompson        FC: gfortran-11
29*751b7b16SJed Brown      run: cargo llvm-cov test --doctests --lcov --output-path lcov.info
30ded9b81dSJeremy L Thompson    - name: Codecov upload
316857ae02SJeremy L Thompson      uses: codecov/codecov-action@v3
32ded9b81dSJeremy L Thompson      with:
33*751b7b16SJed Brown        files: lcov.info
34ded9b81dSJeremy L Thompson        token: ${{secrets.CODECOV_TOKEN}}
35ded9b81dSJeremy L Thompson
36ded9b81dSJeremy L Thompson  style:
37ded9b81dSJeremy L Thompson    strategy:
38ded9b81dSJeremy L Thompson      matrix:
396c0547c1SJeremy L Thompson        os: [ubuntu-22.04]
40db34a149Sjeremylt        compiler: [clang]
418a4ce0d7SJeremy L Thompson
428a4ce0d7SJeremy L Thompson    runs-on: ${{ matrix.os }}
438a4ce0d7SJeremy L Thompson
448a4ce0d7SJeremy L Thompson    steps:
458a4ce0d7SJeremy L Thompson    - name: Environment setup
46ba20f131SJed Brown      uses: actions/checkout@v3
478a4ce0d7SJeremy L Thompson    - name: Rust setup
48ba20f131SJed Brown      uses: dtolnay/rust-toolchain@master
498a4ce0d7SJeremy L Thompson      with:
502ac872feSjeremylt        # Note: rustfmt not always included in nightly, will attempt to downgrade until rustfmt found
512ac872feSjeremylt        toolchain: nightly
522ac872feSjeremylt        components: rustfmt
538a4ce0d7SJeremy L Thompson    - name: Rust style
548a4ce0d7SJeremy L Thompson      run: |
552ac872feSjeremylt        cargo +nightly fmt --version
562ac872feSjeremylt        cargo +nightly fmt -- --check
57