Merge pull request #101 from H1rono/flake #188
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: "-C instrument-coverage" | |
LLVM_PROFILE_FILE: "target/profile/traq-bot-http-rs-%p-%m.profraw" | |
CARGO_UDEPS_VERSION: "0.1.43" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v20 | |
with: | |
nix_path: "nixpkgs=channel:release-23.05" | |
- name: Nix cache | |
uses: DeterminateSystems/magic-nix-cache-action@v2 | |
- name: Clean # not to use old coverage | |
run: "nix develop -c cargo clean" | |
- name: Build | |
run: "nix develop -c cargo build" | |
- name: Check format | |
run: "nix develop -c cargo fmt --all -- --check" | |
- name: Lint | |
run: "nix develop -c cargo clippy --all-targets --all-features -- -D warnings" | |
- name: Run tests | |
run: | | |
nix develop -c cargo test | |
nix develop -c cargo test --features time | |
nix develop -c cargo test --all-features | |
- name: generate LCOV | |
run: | | |
nix develop -c grcov . -s . --binary-path ./target/debug/ -t lcov --branch --ignore-not-existing -o ./target/coverage.lcov | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: target/coverage.lcov | |
check-deps: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install cargo-udeps | |
run: | | |
export UDEPS_ASSET_NAME="cargo-udeps-v${CARGO_UDEPS_VERSION}-x86_64-unknown-linux-gnu" | |
curl -sSL -o cargo-udeps.tar.gz https://github.com/est31/cargo-udeps/releases/download/v${CARGO_UDEPS_VERSION}/${UDEPS_ASSET_NAME}.tar.gz | |
tar -xf cargo-udeps.tar.gz | |
install -m 755 ${UDEPS_ASSET_NAME}/cargo-udeps /usr/local/bin/cargo-udeps | |
rm -rf cargo-udeps.tar.gz ${UDEPS_ASSET_NAME} | |
- name: Check udeps | |
run: | | |
rustup toolchain install nightly | |
cargo +nightly udeps |