Skip to content

Fix two clippy issues. #1047

Fix two clippy issues.

Fix two clippy issues. #1047

Workflow file for this run

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: Expose GitHub Action Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Test
run: ./scripts/run-tests-on-maelstrom.sh "${{ env.ACTIONS_RUNTIME_TOKEN }}" "${{ env.ACTIONS_RESULTS_URL }}"
github_api_tests:
name: Run GitHub API tests
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: Expose GitHub Action Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Test
run: nix develop --command cargo test --package maelstrom-github tests::real_github_integration_test -- --nocapture
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@v3
with:
path: 'website/public'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4