Skip to content

Merge pull request #462 from einarhaaland/fix-abbr-kg-per-energy #648

Merge pull request #462 from einarhaaland/fix-abbr-kg-per-energy

Merge pull request #462 from einarhaaland/fix-abbr-kg-per-energy #648

name: CI - Clippy, Rustfmt, Rustdoc, & Tarpaulin
on: [pull_request, push]
jobs:
tools:
name: Clippy, Rustfmt, & Tarpaulin (Rust ${{ matrix.toolchain }} on ubuntu-latest)
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- 1.82.0
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust nightly toolchain
uses: dtolnay/rust-toolchain@nightly
- name: Install Rust toolchain
id: install-rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: rustfmt, clippy
# Tools-specific cache based on OS/compiler.
- name: Extract tools cache
uses: actions/cache@v4
with:
path: |
~/.cargo
!~/.cargo/registry/index
!~/.cargo/git/checkouts
target
!target/tests
!target/examples
key: tools-${{ runner.os }}-${{ steps.install-rust.outputs.cachekey }}
- name: Clippy
run: cargo clippy --all --tests -- -D warnings
- name: Rustfmt
run: cargo fmt --all -- --check
- name: Rustdoc
run: cargo doc --all --no-deps
env:
RUSTDOCFLAGS: '-D warnings'
- name: Install cargo-binstall
if: ${{ success() && github.event_name == 'push' }}
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
- name: Install tarpaulin
if: ${{ success() && github.event_name == 'push' }}
run: cargo binstall --no-confirm cargo-tarpaulin
- name: Run tarpaulin
if: ${{ success() && github.event_name == 'push' }}
run: cargo +nightly tarpaulin --verbose --timeout 120 --out Xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v1.0.2
if: ${{ success() && github.event_name == 'push' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}