Documentation - Intro #291
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 CI | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Uninstall pre-installed tools | |
run: | | |
rm -f ~/.cargo/bin/rust-analyzer | |
rm -f ~/.cargo/bin/rustfmt | |
rm -f ~/.cargo/bin/cargo-fmt | |
- name: Update Rust toolchain and components | |
run: | | |
rustup update | |
rustup component add rustfmt | |
rustup component add clippy | |
- name: Build | |
run: RUSTFLAGS=-Dwarnings cargo build --all-features --all-targets --verbose | |
- name: Verify target directory exists | |
run: | | |
echo "Checking if target directory exists and is not empty" | |
ls -la target | |
- name: Run tests | |
run: cargo test --verbose | |
- name: Run Clippy | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --all-features --all-targets | |
- name: Check format | |
run: cargo fmt -- --check | |
- name: Build and test documentation | |
run: cargo doc --no-deps --verbose | |
- name: Cache Cargo registry | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-registry- | |
- name: Cache Cargo build | |
uses: actions/cache@v3 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-build- | |
docs: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- name: ✅ Checkout | |
uses: actions/checkout@v4 | |
- name: 🪨 Setup mdBook | |
uses: peaceiris/actions-mdbook@v2 | |
with: | |
mdbook-version: '0.4.40' | |
- name: 📓 Build website | |
run: mdbook build website | |
- name: 🚀 Deploy | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./website/book | |
cname: alba.cardano-scaling.org |