Use a lock file to keep duplicate workers and brokers from intefering… #995
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-24.04 | |
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-24.04 | |
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-24.04 | |
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: Disable apparmor container restrictions | |
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 | |
- name: Install Nix Flake | |
run: nix develop --command echo done | |
- name: Get Rust version | |
run: echo "RUST_VERSION=$(nix develop --command rustc --version | cut -d' ' -f2)" >> $GITHUB_ENV | |
- name: Set up Rust Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: maelstrom-${{ hashFiles('Cargo.lock', 'flake.lock') }}-${{ env.RUST_VERSION }} | |
- name: Test | |
run: ./scripts/run-tests-on-maelstrom.sh | |
deploy-documentation: | |
name: Build and Deploy Documentation | |
runs-on: ubuntu-24.04 | |
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: | | |
mkdir -p website/static/doc/book | |
cd doc/book | |
./build-all-versions.sh ../../website/static/doc/book | |
- name: Install Zola | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: [email protected] | |
- name: Build Website with Zola | |
run: | | |
cd website | |
zola build | |
- name: Set up Pages | |
uses: actions/configure-pages@v4 | |
- name: Upload Artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: 'website/public' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |