chore(deps): update dependency @types/node to v20.17.10 #1554
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: | |
env: | |
RUSTDOCFLAGS: "--default-theme ayu" | |
RUST_BACKTRACE: "1" | |
# speed up build by using clang/lld | |
CC: "clang-14" | |
CXX: "clang++-14" | |
LD: "clang-14" | |
LDFLAGS: "-fuse-ld=lld-14" | |
RUSTFLAGS: "-C linker=clang-14 -C link-arg=-fuse-ld=lld-14" | |
jobs: | |
webpack: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '16' | |
- run: cd redoc/src && npm install && npm run webpack | |
- run: git diff --exit-code redoc/src | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
rust: | |
- name: MSRV | |
toolchain: "1.73" | |
nightly: false | |
- name: Stable | |
toolchain: stable | |
nightly: false | |
- name: beta | |
toolchain: beta | |
nightly: false | |
- name: nightly | |
toolchain: nightly | |
nightly: true | |
features: | |
- name: default | |
flags: "" | |
- name: openapi | |
flags: "--no-default-features --features openapi" | |
- name: full | |
flags: "--no-default-features --features full" | |
runs-on: ubuntu-latest | |
name: Test on Rust ${{matrix.rust.name}} with ${{matrix.features.name}} features | |
continue-on-error: ${{matrix.rust.nightly}} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
if: matrix.rust.name == 'MSRV' | |
- name: cargo -Z minimal-versions update | |
run: | | |
set -x | |
cargo -Z minimal-versions update | |
cargo update --precise 1.3.0 lazy_static | |
cargo update tracing | |
if: matrix.rust.name == 'MSRV' | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{matrix.rust.toolchain}} | |
id: rust-toolchain | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/git | |
~/.cargo/registry | |
target | |
key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}}" | |
- name: cargo test ${{matrix.features.flags}} | |
run: | | |
set -x | |
locked= | |
if [ "${{matrix.rust.name}}" == "MSRV" ]; then | |
export RUSTFLAGS="$RUSTFLAGS --cfg gotham_restful_deny_warnings" | |
locked="--locked" | |
fi | |
cargo test $locked ${{matrix.features.flags}} | |
test-trybuild: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: "1.82" | |
id: rust-toolchain | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/git | |
~/.cargo/registry | |
target | |
key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}} (trybuild)" | |
- run: cargo test --no-default-features --features full --tests -- --ignored | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: "1.78" | |
components: clippy | |
id: rust-toolchain | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/git | |
~/.cargo/registry | |
target | |
key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}} (clippy)" | |
- run: cargo clippy --workspace --profile test -- -Dclippy::all | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- run: cargo fmt --all -- --check | |
- run: ./tests/ui/rustfmt.sh --check | |
readme: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker://ghcr.io/msrd0/cargo-doc2readme | |
with: | |
entrypoint: ./readme.sh | |
args: --check | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
id: rust-toolchain | |
- name: Get Tarpaulin Version | |
id: tarpaulin-version | |
run: echo "version=$(wget -qO- 'https://crates.io/api/v1/crates/cargo-tarpaulin' | jq -r '.crate.max_stable_version')" >>$GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/cargo-tarpaulin | |
~/.cargo/git | |
~/.cargo/registry | |
target | |
key: "${{runner.os}} Rust ${{steps.rust-version.outputs.version}} tarpaulin ${{steps.tarpaulin-version.outputs.version}}" | |
- name: Install Tarpaulin | |
run: | | |
test -e ~/.cargo/bin/cargo-tarpaulin || cargo install cargo-tarpaulin --version ${{steps.tarpaulin-version.outputs.version}} | |
- name: Run Tarpaulin coverage tests | |
run: | | |
cargo tarpaulin --verbose \ | |
--target-dir target/tarpaulin \ | |
--no-default-features \ | |
--features full \ | |
--exclude-files 'derive/*' \ | |
--exclude-files 'target/*' \ | |
--ignore-panics --ignore-tests \ | |
--out html --out json | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: tarpaulin-report | |
path: | | |
tarpaulin-report.json | |
tarpaulin-report.html | |
doc: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo | |
target | |
key: ${{runner.os}}-cargo-doc | |
- run: RUSTDOCFLAGS="$RUSTDOCFLAGS --cfg gotham_restful_deny_warnings" cargo doc --no-default-features --features full --no-deps | |
- run: tar cfJ rustdoc.tar.xz target/doc/ | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: rustdoc | |
path: rustdoc.tar.xz | |
pages: | |
runs-on: ubuntu-latest | |
needs: [coverage, doc] | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
- uses: actions/download-artifact@v4 | |
with: | |
name: rustdoc | |
- uses: actions/download-artifact@v4 | |
with: | |
name: tarpaulin-report | |
- run: | | |
test ! -d ./doc || rm -r ./doc | |
tar xfJ rustdoc.tar.xz --strip-components=1 | |
rm rustdoc.tar.xz | |
date >./doc/.timestamp | |
coverage=$(jq '.files | { covered: map(.covered) | add, coverable: map(.coverable) | add } | .covered / .coverable * 10000 | round | . / 100' tarpaulin-report.json) | |
color=$([[ $coverage < 80 ]] && printf yellow || printf brightgreen) | |
wget -qO coverage.svg "https://img.shields.io/badge/coverage-$coverage%25-$color" | |
git add ./doc coverage.svg || true | |
git status | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: "GitHub Pages for ${{github.sha}}" |