Create a .github/workflows/main.yml file in your repository root to define automated test and lint jobs that run on every push and pull request.
name: CI
on: [push, pull_request]
env:
MDBOOK_VERSION: 0.5.1
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- run: rustup self update
- run: |
rustup set profile minimal
rustup toolchain install 1.90 -c rust-docs
rustup default 1.90
- run: |
mkdir bin
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
echo "$(pwd)/bin" >> "${GITHUB_PATH}"
- run: |
cd packages/trpl
cargo build
- run: mdbook test --library-path packages/trpl/target/debug/deps
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- run: rustup self update
- run: |
rustup set profile minimal
rustup toolchain install nightly -c rust-docs
rustup override set nightly
- run: |
mkdir bin
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
echo "$(pwd)/bin" >> "${GITHUB_PATH}"
- run: sudo apt-get install aspell shellcheck
- run: find . -name '*.sh' -print0 | xargs -0 shellcheck
- run: bash ci/spellcheck.sh list
- run: |
mdbook build
cargo run --bin lfp src
- run: bash ci/validate.sh
- run: |
curl -sSLo linkcheck.sh https://raw.githubusercontent.com/rust-lang/rust/HEAD/src/tools/linkchecker/linkcheck.sh
sh linkcheck.sh book
This workflow installs Rust and mdbook, builds the trpl crate, runs mdbook test with the correct library path, and executes linting checks for shell scripts, spelling, local file paths, references, and broken links.