From e5a39cd412c733112febe90c0423ec884518555a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niko=20H=C3=A4m=C3=A4l=C3=A4inen?= Date: Sat, 29 Aug 2026 23:32:43 +0300 Subject: [PATCH] Run each Python project's checks as parallel steps mypy, pyright and pytest each had a job of their own, per project, so the same checkout and cache restore was paid six times to run about 12s of checks. Move each project's three checks into one job of parallel steps, as was done for the root checks. The two projects keep a job each rather than sharing one. They are checked independently: aoc-main's checks do not need solvers/python, and solvers/python's checks do not need aoc-main. Sharing a job would also mean sharing a uv cache entry, so aoc-main would miss cache whenever solvers/python's lockfile changed, and a broken sync in one project would block the other's type checks. With the checks consolidated, ci-python-project holds nothing but a parameter that no longer varies anything, so it is removed along with the mise-uv-task wrapper it was the last caller of. Its remaining jobs move up to ci.yaml: python-run.yaml is called directly, and the uv-cache job becomes a top level job named for its runner like its aoc-main siblings. The conditionals that skipped both of those for aoc-main go with it. --- .../{mise-uv-task.yaml => checks-python.yaml} | 44 ++++++----- .github/workflows/ci-python-project.yaml | 78 ------------------- .github/workflows/ci.yaml | 48 ++++++++---- 3 files changed, 56 insertions(+), 114 deletions(-) rename .github/workflows/{mise-uv-task.yaml => checks-python.yaml} (50%) delete mode 100644 .github/workflows/ci-python-project.yaml diff --git a/.github/workflows/mise-uv-task.yaml b/.github/workflows/checks-python.yaml similarity index 50% rename from .github/workflows/mise-uv-task.yaml rename to .github/workflows/checks-python.yaml index 6b7a775d..c8714640 100644 --- a/.github/workflows/mise-uv-task.yaml +++ b/.github/workflows/checks-python.yaml @@ -1,36 +1,29 @@ -name: Mise + uv - run task +name: Checks - Python project on: workflow_call: inputs: directory: - description: Directory containing uv project and mise task - required: true - type: string - task: - description: Task to run + description: Python project directory required: true type: string workflow_dispatch: inputs: directory: - description: Directory containing uv project and mise task + description: Python project directory options: - aoc-main - solvers/python required: true type: choice - task: - description: Task to run - required: true - type: string permissions: contents: read jobs: - task: - name: Run mise task with uv - ${{ inputs.task }} + # Every check that also needs a uv virtual environment + checks: + name: Run checks runs-on: ubuntu-24.04 - timeout-minutes: 30 + timeout-minutes: 15 steps: - name: Checkout @@ -46,10 +39,21 @@ jobs: with: directory: ${{ inputs.directory }} - - name: Run task - ${{ inputs.task }} + - parallel: + - name: check:mypy + + run: mise run check:mypy + shell: bash + working-directory: ${{ inputs.directory }} + + - name: check:pyright + + run: mise run check:pyright + shell: bash + working-directory: ${{ inputs.directory }} + + - name: check:pytest - env: - MISE_TASK: ${{ inputs.task }} - run: mise run "${MISE_TASK}" - shell: bash - working-directory: ${{ inputs.directory }} + run: mise run check:pytest + shell: bash + working-directory: ${{ inputs.directory }} diff --git a/.github/workflows/ci-python-project.yaml b/.github/workflows/ci-python-project.yaml deleted file mode 100644 index 184fb0b4..00000000 --- a/.github/workflows/ci-python-project.yaml +++ /dev/null @@ -1,78 +0,0 @@ -name: CI - Python tooling -on: - workflow_call: - inputs: - directory: - description: Python project directory - required: true - type: string - workflow_dispatch: - inputs: - directory: - description: Python project directory - options: - - aoc-main - - solvers/python - required: true - type: choice -permissions: - contents: read - -jobs: - uv-cache: - if: inputs.directory != 'aoc-main' - uses: ./.github/workflows/mise-uv-prepare-cache.yaml - with: - directory: ${{ inputs.directory }} - runner: ubuntu-24.04 - - concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-uv-${{ inputs.directory }} - - # Checks - check-mypy: - if: always() && contains(fromJSON('["skipped", "success"]'), needs.uv-cache.result) - needs: uv-cache - uses: ./.github/workflows/mise-uv-task.yaml - with: - directory: ${{ inputs.directory }} - task: check:mypy - - check-pyright: - if: always() && contains(fromJSON('["skipped", "success"]'), needs.uv-cache.result) - needs: uv-cache - uses: ./.github/workflows/mise-uv-task.yaml - with: - directory: ${{ inputs.directory }} - task: check:pyright - - run-all: - if: inputs.directory != 'aoc-main' - needs: uv-cache - uses: ./.github/workflows/python-run.yaml - secrets: inherit - - test-pytest: - if: always() && contains(fromJSON('["skipped", "success"]'), needs.uv-cache.result) - needs: uv-cache - uses: ./.github/workflows/mise-uv-task.yaml - with: - directory: ${{ inputs.directory }} - task: check:pytest - - # Check for all green CI for a python project - check: - if: always() - needs: - - check-mypy - - check-pyright - - run-all - - test-pytest - runs-on: ubuntu-24.04 - timeout-minutes: 5 - - steps: - - uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 - with: - allowed-skips: ${{ inputs.directory == 'aoc-main' && '["run-all"]' || '' }} - jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6a5059b5..2fc14e60 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -35,7 +35,7 @@ jobs: concurrency: group: ${{ github.workflow }}-${{ github.ref }}-mise-root-ubuntu - # uv cache prepare for aoc-main + # uv cache prepare uv-cache-aoc-main-macos: needs: mise-cache-macos uses: ./.github/workflows/mise-uv-prepare-cache.yaml @@ -56,6 +56,16 @@ jobs: concurrency: group: ${{ github.workflow }}-${{ github.ref }}-uv-aoc-main-ubuntu + uv-cache-solvers-python-ubuntu: + needs: mise-cache-ubuntu + uses: ./.github/workflows/mise-uv-prepare-cache.yaml + with: + directory: solvers/python + runner: ubuntu-24.04 + + concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-uv-solvers-python-ubuntu + # Homebrew cache prepare homebrew-cache-macos: uses: ./.github/workflows/homebrew-prepare-cache.yaml @@ -78,15 +88,30 @@ jobs: needs: mise-cache-ubuntu uses: ./.github/workflows/checks-mise.yaml - # CI workflows for projects in the repository - ci-aoc-main: + checks-aoc-main: needs: - mise-cache-ubuntu - uv-cache-aoc-main-ubuntu - uses: ./.github/workflows/ci-python-project.yaml + uses: ./.github/workflows/checks-python.yaml with: directory: aoc-main + checks-solvers-python: + needs: + - mise-cache-ubuntu + - uv-cache-solvers-python-ubuntu + uses: ./.github/workflows/checks-python.yaml + with: + directory: solvers/python + + # Run the Python solvers + solvers-python: + needs: + - mise-cache-ubuntu + - uv-cache-solvers-python-ubuntu + uses: ./.github/workflows/python-run.yaml + secrets: inherit + # CI for C++ solvers ci-solvers-cpp: needs: @@ -102,16 +127,6 @@ jobs: homebrew-downloads-hash-from-prepare-macos: ${{ needs.homebrew-cache-macos.outputs.downloads-hash }} homebrew-downloads-hash-from-prepare-ubuntu: ${{ needs.homebrew-cache-ubuntu.outputs.downloads-hash }} - # CI for Python solvers - ci-solvers-python: - needs: - - mise-cache-ubuntu - - uv-cache-aoc-main-ubuntu - uses: ./.github/workflows/ci-python-project.yaml - secrets: inherit - with: - directory: solvers/python - # CI for Rust solvers ci-solvers-rust: needs: @@ -126,11 +141,12 @@ jobs: check: if: always() needs: + - checks-aoc-main - checks-mise - - ci-aoc-main + - checks-solvers-python - ci-solvers-cpp - - ci-solvers-python - ci-solvers-rust + - solvers-python runs-on: ubuntu-24.04 timeout-minutes: 5