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