✨ 新しいエラー型 #363
Workflow file for this run
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" | |
GRCOV_VERSION: "0.8.19" | |
jobs: | |
nix-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install nix | |
uses: cachix/install-nix-action@V27 | |
with: | |
nix_path: "nixpkgs=channel:release-23.05" | |
- name: Nix cache | |
uses: DeterminateSystems/magic-nix-cache-action@v7 | |
- name: Checks | |
run: nix flake check | |
- name: Build | |
run: nix build | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Rust cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Install grcov | |
run: | | |
curl -sSL -o grcov.tar.bz2 https://github.com/mozilla/grcov/releases/download/v${GRCOV_VERSION}/grcov-x86_64-unknown-linux-gnu.tar.bz2 | |
tar -jxf grcov.tar.bz2 | |
rm grcov.tar.bz2 | |
- name: Clean # not to use old coverage | |
run: cargo clean | |
- name: Run tests | |
run: | | |
mkdir -p target/profile | |
cargo test | |
cargo test --features time | |
cargo test --all-features | |
- name: generate LCOV | |
run: | | |
./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@v4 | |
with: | |
files: target/coverage.lcov | |
token: ${{ secrets.CODECOV_TOKEN }} | |
check-deps: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 |