obelisk 0.41.4

Deterministic workflow engine
name: check
permissions:
  contents: read
# This configuration allows maintainers of this repo to create a branch and pull request based on
# the new branch. Restricting the push trigger to the main branch ensures that the PR only gets
# built once.
on:
  push:
    branches:
      - main
      - latest
  pull_request:

# If new code is pushed to a PR branch, then cancel in progress workflows for that PR.
concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

defaults:
  run:
    shell: bash -xe {0}

jobs:
  fmt:
    name: cargo fmt
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

      - uses: cachix/install-nix-action@13d8dd58da0234aa297dedd986986ccb8e7f3e24 # v31.11.1
        with:
          github_access_token: ${{ secrets.GITHUB_TOKEN }}
      - name: Populate the nix store
        run: nix develop --command echo

      - name: cargo fmt
        run: nix develop --command cargo fmt --check

  check-dev-deps:
    name: Check dev-deps.txt
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
      - uses: cachix/install-nix-action@13d8dd58da0234aa297dedd986986ccb8e7f3e24 # v31.11.1
        with:
          github_access_token: ${{ secrets.GITHUB_TOKEN }}
      - name: Populate the nix store
        run: nix develop --command echo

      - run: nix develop --command ./scripts/dev-deps.sh
      - run: |
          if git diff --quiet; then
              echo "No changes"
          else
              echo "::error::Changes in dev-deps.txt detected"
              git diff
              exit 1
          fi

  check-js-runtime-freshness:
    name: JS runtime pins up to date
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
        with:
          fetch-depth: 0

      - name: Check JS runtime version pins are newer than their sources
        run: ./scripts/check-js-runtime-freshness.sh

  check-embedded-assets:
    name: Embedded asset hash
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

      - uses: cachix/install-nix-action@13d8dd58da0234aa297dedd986986ccb8e7f3e24 # v31.11.1
        with:
          github_access_token: ${{ secrets.GITHUB_TOKEN }}

      - name: Verify embedded asset hash
        run: |
          ./scripts/update-embedded-assets-hash.sh
          git diff --exit-code -- flake.nix

  deny:
    name: cargo deny
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

      - uses: cachix/install-nix-action@13d8dd58da0234aa297dedd986986ccb8e7f3e24 # v31.11.1
        with:
          github_access_token: ${{ secrets.GITHUB_TOKEN }}
      - name: Populate the nix store
        run: nix develop --command echo

      - name: cargo deny
        run: nix develop --command cargo deny --config .config/deny.toml check

  clippy:
    name: clippy
    runs-on: ubuntu-24.04
    strategy:
      fail-fast: false
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

      - uses: cachix/install-nix-action@13d8dd58da0234aa297dedd986986ccb8e7f3e24 # v31.11.1
        with:
          github_access_token: ${{ secrets.GITHUB_TOKEN }}
      - name: Populate the nix store
        run: nix develop --command echo

      - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
        with:
          cache-on-failure: true

      - name: cargo clippy
        run: nix develop --command cargo clippy --workspace --all-targets -- -D warnings