handlerまわりのdocs #406
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: | |
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 | |
- 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 | |
if: github.repository_owner == 'H1rono' || github.repository_owner == 'h1rono' | |
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 |