Skip to content

静的解析ツールを追加 #169

静的解析ツールを追加

静的解析ツールを追加 #169

Workflow file for this run

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"
GRCOV_VERSION: "0.8.13"
CARGO_UDEPS_VERSION: "0.1.43"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache build
uses: Swatinem/rust-cache@v2
- name: Add components
run: |
rustup component add rustfmt
rustup component add clippy
rustup component add llvm-tools
- 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: Build
run: cargo build
- name: Check format
run: cargo fmt --all -- --check
- name: Lint
run: cargo clippy --all-targets --all-features -- -D warnings
- 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@v3
with:
files: target/coverage.lcov
check-deps:
runs-on: ubuntu-latest
permissions:
issues: write
checks: write
steps:
- uses: actions/checkout@v3
- uses: rustsec/audit-check@v1.4.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- 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