mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: add and fix more lints, improve docs (#4765)
This commit is contained in:
30
.github/workflows/book.yml
vendored
30
.github/workflows/book.yml
vendored
@ -19,13 +19,13 @@ jobs:
|
||||
run: |
|
||||
mkdir mdbook
|
||||
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
|
||||
echo `pwd`/mdbook >> $GITHUB_PATH
|
||||
echo $(pwd)/mdbook >> $GITHUB_PATH
|
||||
|
||||
- name: Install mdbook-template
|
||||
run: |
|
||||
mkdir mdbook-template
|
||||
curl -sSL https://github.com/sgoudham/mdbook-template/releases/latest/download/mdbook-template-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook-template
|
||||
echo `pwd`/mdbook-template >> $GITHUB_PATH
|
||||
echo $(pwd)/mdbook-template >> $GITHUB_PATH
|
||||
|
||||
- name: Run tests
|
||||
run: mdbook test
|
||||
@ -43,8 +43,8 @@ jobs:
|
||||
mkdir mdbook-linkcheck
|
||||
curl -sSL -o mdbook-linkcheck.zip https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/latest/download/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip
|
||||
unzip mdbook-linkcheck.zip -d ./mdbook-linkcheck
|
||||
chmod +x `pwd`/mdbook-linkcheck/mdbook-linkcheck
|
||||
echo `pwd`/mdbook-linkcheck >> $GITHUB_PATH
|
||||
chmod +x $(pwd)/mdbook-linkcheck/mdbook-linkcheck
|
||||
echo $(pwd)/mdbook-linkcheck >> $GITHUB_PATH
|
||||
|
||||
- name: Run linkcheck
|
||||
run: mdbook-linkcheck --standalone
|
||||
@ -54,32 +54,32 @@ jobs:
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install toolchain
|
||||
uses: dtolnay/rust-toolchain@nightly
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-on-failure: true
|
||||
- uses: dtolnay/rust-toolchain@nightly
|
||||
|
||||
- name: Install mdbook
|
||||
run: |
|
||||
mkdir mdbook
|
||||
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
|
||||
echo `pwd`/mdbook >> $GITHUB_PATH
|
||||
echo $(pwd)/mdbook >> $GITHUB_PATH
|
||||
|
||||
- name: Install mdbook-template
|
||||
run: |
|
||||
mkdir mdbook-template
|
||||
curl -sSL https://github.com/sgoudham/mdbook-template/releases/latest/download/mdbook-template-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook-template
|
||||
echo `pwd`/mdbook-template >> $GITHUB_PATH
|
||||
echo $(pwd)/mdbook-template >> $GITHUB_PATH
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: Build book
|
||||
run: mdbook build
|
||||
|
||||
- name: Build docs
|
||||
run: RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo +nightly doc --all --no-deps
|
||||
run: cargo docs
|
||||
env:
|
||||
# Keep in sync with ./ci.yml:jobs.docs
|
||||
RUSTDOCFLAGS:
|
||||
--cfg docsrs --show-type-layout --generate-link-to-definition --enable-index-page
|
||||
-Zunstable-options
|
||||
|
||||
- name: Move docs to book folder
|
||||
run: |
|
||||
|
||||
91
.github/workflows/ci.yml
vendored
91
.github/workflows/ci.yml
vendored
@ -5,64 +5,53 @@ on:
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
RUSTFLAGS: -D warnings
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
name: ci
|
||||
jobs:
|
||||
lint:
|
||||
name: code lint
|
||||
runs-on: ubuntu-20.04
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v3
|
||||
- name: Install toolchain
|
||||
uses: dtolnay/rust-toolchain@nightly
|
||||
with:
|
||||
components: rustfmt, clippy
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-on-failure: true
|
||||
|
||||
- name: cargo check
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
args: --all --all-features --benches --tests
|
||||
|
||||
- name: cargo fmt
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: fmt
|
||||
args: --all --check
|
||||
|
||||
- name: cargo clippy
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: clippy
|
||||
args: --all --all-features --benches --tests
|
||||
|
||||
doc-lint:
|
||||
name: doc lint
|
||||
runs-on: ubuntu-20.04
|
||||
timeout-minutes: 60
|
||||
clippy:
|
||||
name: clippy
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- uses: dtolnay/rust-toolchain@clippy
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Check if documentation builds
|
||||
run: RUSTDOCFLAGS="-D warnings" cargo doc --all --no-deps --all-features --document-private-items
|
||||
- run: cargo clippy --workspace --all-targets --all-features
|
||||
env:
|
||||
RUSTFLAGS: -D warnings
|
||||
|
||||
docs:
|
||||
name: docs
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@nightly
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: cargo docs --document-private-items
|
||||
env:
|
||||
# Keep in sync with ./book.yml:jobs.build
|
||||
# This should only add `-D warnings`
|
||||
RUSTDOCFLAGS:
|
||||
--cfg docsrs --show-type-layout --generate-link-to-definition --enable-index-page
|
||||
-Zunstable-options -D warnings
|
||||
|
||||
fmt:
|
||||
name: fmt
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@nightly
|
||||
with:
|
||||
components: rustfmt
|
||||
- run: cargo fmt --all --check
|
||||
|
||||
grafana-lint:
|
||||
name: grafana lint
|
||||
runs-on: ubuntu-20.04
|
||||
timeout-minutes: 60
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Check dashboard JSON with jq
|
||||
@ -73,9 +62,9 @@ jobs:
|
||||
lint-success:
|
||||
if: always()
|
||||
name: lint success
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [lint, doc-lint, grafana-lint]
|
||||
timeout-minutes: 60
|
||||
runs-on: ubuntu-latest
|
||||
needs: [clippy, docs, fmt, grafana-lint]
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: Decide whether the needed jobs succeeded or failed
|
||||
uses: re-actors/alls-green@release/v1
|
||||
|
||||
Reference in New Issue
Block a user