From 70f5f8f43a8e68ad40eb21207572cd3302492b31 Mon Sep 17 00:00:00 2001 From: isaac Date: Mon, 16 Nov 2026 11:11:12 +0900 Subject: [PATCH] ci: run macOS tests only on tags and dispatch --- .github/workflows/ci.yml | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd2e79c..09eba84 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,21 +3,38 @@ name: Tests on: push: branches: [main] + tags: ["v*"] pull_request: + workflow_dispatch: + +# A newer push to a pull request replaces the run that is still going +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: + plan: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.pick.outputs.matrix }} + steps: + - id: pick + shell: bash + # macOS runs only on release tags or manual dispatch; Linux and Windows run on every push + run: | + base='{"os":"ubuntu-latest","python":"3.10"},{"os":"ubuntu-latest","python":"3.12"},{"os":"ubuntu-latest","python":"3.13"},{"os":"ubuntu-latest","python":"3.14"},{"os":"windows-latest","python":"3.14"}' + if [[ "$GITHUB_REF" == refs/tags/v* || "$GITHUB_EVENT_NAME" == workflow_dispatch ]]; then + echo "matrix={\"include\":[$base,{\"os\":\"macos-latest\",\"python\":\"3.14\"}]}" >> "$GITHUB_OUTPUT" + else + echo "matrix={\"include\":[$base]}" >> "$GITHUB_OUTPUT" + fi + test: + needs: plan runs-on: ${{ matrix.os }} strategy: fail-fast: false - matrix: - include: - - {os: ubuntu-latest, python: "3.10"} - - {os: ubuntu-latest, python: "3.12"} - - {os: ubuntu-latest, python: "3.13"} - - {os: ubuntu-latest, python: "3.14"} - - {os: windows-latest, python: "3.14"} - - {os: macos-latest, python: "3.14"} + matrix: ${{ fromJSON(needs.plan.outputs.matrix) }} steps: - uses: actions/checkout@v7 - uses: astral-sh/setup-uv@v10.3.3