Add CI for rustdoc #11
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: CI | |
on: [push, pull_request] | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check code format | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
- name: Clippy | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --all-features | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --no-fail-fast # Customize args for your own needs | |
env: | |
CARGO_INCREMENTAL: '0' | |
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' | |
- id: coverage | |
uses: actions-rs/[email protected] | |
- name: Coveralls upload | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: ${{ steps.coverage.outputs.report }} | |
- name: Run benchmarks | |
uses: actions-rs/cargo@v1 | |
with: | |
command: bench | |
doc: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
permissions: | |
contents: write | |
env: | |
default-branch: ${{ format('refs/heads/{0}', github.event.repository.default_branch) }} | |
RUSTDOCFLAGS: -D rustdoc::broken_intra_doc_links -D missing-docs | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build docs | |
uses: actions-rs/cargo@v1 | |
continue-on-error: ${{ github.ref != env.default-branch && github.event_name != 'pull_request' }} | |
with: | |
command: doc | |
args: --no-deps --all-features | |
- name: Generate index.html | |
run: | | |
printf '<meta http-equiv="refresh" content="0;url=%s/index.html">' $(cargo tree | head -1 | cut -d' ' -f1) > target/doc/index.html | |
- name: Deploy to Github Pages | |
if: ${{ github.ref == env.default-branch }} | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
single-commit: true | |
branch: gh-pages | |
folder: target/doc |