cargo-llvm-cov
使う
#469
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 | |
CARGO_UDEPS_VERSION: "0.1.43" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Rust cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Build | |
run: | | |
cargo build --workspace | |
cargo build --package traq-bot-http --no-default-features | |
cargo build --package traq-bot-http --features time | |
cargo build --package traq-bot-http --features 'uuid chrono' | |
cargo build --package traq-bot-http --features http | |
cargo build --package traq-bot-http --all-features | |
- name: Lint | |
run: | | |
cargo clippy --workspace -- -D warnings | |
cargo clippy --package traq-bot-http --no-default-features -- -D warnings | |
cargo clippy --package traq-bot-http --features 'uuid time' -- -D warnings | |
cargo clippy --package traq-bot-http --features 'chrono http' -- -D warnings | |
cargo clippy --package traq-bot-http --all-features -- -D warnings | |
- name: Format | |
run: | | |
cargo fmt --all --check | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: 'false' | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-llvm-cov | |
- name: Collect coverage | |
run: | | |
cargo llvm-cov clean --workspace | |
cargo llvm-cov test --no-report --package traq-bot-http --no-default-features | |
cargo llvm-cov test --no-report --package traq-bot-http --features time | |
cargo llvm-cov test --no-report --package traq-bot-http --features 'uuid chrono' | |
cargo llvm-cov test --no-report --package traq-bot-http --features tower | |
cargo llvm-cov test --no-report --package traq-bot-http --all-features | |
cargo llvm-cov report --lcov --output-path lcov.info | |
- name: Upload coverage to Codecov | |
if: github.repository_owner == 'H1rono' || github.repository_owner == 'h1rono' | |
uses: codecov/codecov-action@v5 | |
with: | |
files: lcov.info | |
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 |