Upgrade to upload-pages-artifact@v3. #116
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, workflow_dispatch ] | |
jobs: | |
check_nix_packages: | |
name: Check Nix Flake | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get Repository from Git | |
uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@main | |
- name: Set up Nix Cache | |
uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: Check Nixpkgs Inputs | |
uses: DeterminateSystems/flake-checker-action@main | |
lint: | |
name: Run Rustfmt and Clippy on Rust | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get Repository from Git | |
uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@main | |
- name: Set up Nix Cache | |
uses: DeterminateSystems/magic-nix-cache-action@main | |
# For some reason, GitHub provides Rust for us. The problem is that, when | |
# executing the recursive cargo invocation, the cargo in ~/.cargo/bin ends | |
# up prepended to PATH, which then causes problems. | |
- name: Remove Rust provided by GitHub. | |
run: rm -rf ~/.cargo ~/.rustup | |
- name: Lint | |
run: ./scripts/lint.sh | |
run_all_tests_on_maelstrom: | |
name: Run All Maelstrom Tests on Maelstrom | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get Repository from Git | |
uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@main | |
- name: Set up Nix Cache | |
uses: DeterminateSystems/magic-nix-cache-action@main | |
# For some reason, GitHub provides Rust for us. The problem is that, when | |
# executing the recursive cargo invocation, the cargo in ~/.cargo/bin ends | |
# up prepended to PATH, which then causes problems. | |
- name: Remove Rust provided by GitHub. | |
run: rm -rf ~/.cargo/bin ~/.rustup | |
- name: Set up Rust Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: maelstrom-${{ hashFiles('**/Cargo.lock') }} | |
- name: Test | |
run: ./scripts/run-tests-on-maelstrom.sh | |
deploy-documentation: | |
name: Build and Deploy Documentation | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # To push a branch | |
pages: write # To push to a GitHub Pages site | |
id-token: write # To update the deployment status | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Latest mdBook | |
run: | | |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name') | |
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz" | |
mkdir mdbook | |
curl -sSL $url | tar -xz --directory=./mdbook | |
echo `pwd`/mdbook >> $GITHUB_PATH | |
- name: Build Documentation | |
run: | | |
cd site | |
mdbook build | |
- name: Set up Pages | |
uses: actions/configure-pages@v4 | |
- name: Upload Artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
# Upload entire repository | |
path: 'site/book' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |