xref: /libCEED/.github/workflows/rust-test-with-style.yml (revision d0a36517796255eea4e58040c8514e1a8b588ea4)
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:
21751b7b16SJed Brown        # Note: nightly required for coverage of Doctests
22ded9b81dSJeremy L Thompson        toolchain: nightly
23b34efc53SJed Brown        components: llvm-tools-preview
24751b7b16SJed Brown    - name: Install cargo-llvm-cov
25b34efc53SJed Brown      uses: taiki-e/install-action@v2
26b34efc53SJed Brown      with:
27*d0a36517SJed Brown        tool: cargo-llvm-cov
28ded9b81dSJeremy L Thompson    - name: Rust test with coverage
29ded9b81dSJeremy L Thompson      env:
30ded9b81dSJeremy L Thompson        CC: ${{ matrix.compiler }}
316c0547c1SJeremy L Thompson        FC: gfortran-11
32751b7b16SJed Brown      run: cargo llvm-cov test --doctests --lcov --output-path lcov.info
33ded9b81dSJeremy L Thompson    - name: Codecov upload
346857ae02SJeremy L Thompson      uses: codecov/codecov-action@v3
35ded9b81dSJeremy L Thompson      with:
36751b7b16SJed Brown        files: lcov.info
37ded9b81dSJeremy L Thompson        token: ${{secrets.CODECOV_TOKEN}}
38ded9b81dSJeremy L Thompson
39ded9b81dSJeremy L Thompson  style:
40ded9b81dSJeremy L Thompson    strategy:
41ded9b81dSJeremy L Thompson      matrix:
426c0547c1SJeremy L Thompson        os: [ubuntu-22.04]
43db34a149Sjeremylt        compiler: [clang]
448a4ce0d7SJeremy L Thompson
458a4ce0d7SJeremy L Thompson    runs-on: ${{ matrix.os }}
468a4ce0d7SJeremy L Thompson
478a4ce0d7SJeremy L Thompson    steps:
488a4ce0d7SJeremy L Thompson    - name: Environment setup
49ba20f131SJed Brown      uses: actions/checkout@v3
508a4ce0d7SJeremy L Thompson    - name: Rust setup
51ba20f131SJed Brown      uses: dtolnay/rust-toolchain@master
528a4ce0d7SJeremy L Thompson      with:
532ac872feSjeremylt        # Note: rustfmt not always included in nightly, will attempt to downgrade until rustfmt found
542ac872feSjeremylt        toolchain: nightly
552ac872feSjeremylt        components: rustfmt
568a4ce0d7SJeremy L Thompson    - name: Rust style
578a4ce0d7SJeremy L Thompson      run: |
582ac872feSjeremylt        cargo +nightly fmt --version
592ac872feSjeremylt        cargo +nightly fmt -- --check
60