From 66a5dcd62db51491199bfed649f515912b36ff46 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Mon, 15 Jul 2024 20:18:12 +0200 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=A7=AA=F0=9F=92=85=20Move=20macOS=20m?= =?UTF-8?q?atrix=20to=20the=20calling=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, part of it was passed to the reusable workflow where another part was being populated. Now, the entire matrix is defined in a single place, in the calling workflow. --- .github/workflows/build.yml | 39 +++++++++++++++++++++++----- .github/workflows/reusable-macos.yml | 22 +++++----------- 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e1d9e1632f136c..5fdfbb95de0e62 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -202,24 +202,51 @@ jobs: name: 'macOS' needs: check_source if: needs.check_source.outputs.run_tests == 'true' + strategy: + fail-fast: false + matrix: + # Cirrus and macos-14 are M1, macos-13 is default GHA Intel. + # Cirrus used for upstream, macos-14 for forks. + os: + - ghcr.io/cirruslabs/macos-runner:sonoma + - macos-14 + - macos-13 + is-fork: # only used for the exclusion trick + - ${{ github.repository_owner != 'python' }} + exclude: + - os: ghcr.io/cirruslabs/macos-runner:sonoma + is-fork: true + - os: macos-14 + is-fork: false uses: ./.github/workflows/reusable-macos.yml with: config_hash: ${{ needs.check_source.outputs.config_hash }} - # Cirrus and macos-14 are M1, macos-13 is default GHA Intel. - # Cirrus used for upstream, macos-14 for forks. - os-matrix: '["ghcr.io/cirruslabs/macos-runner:sonoma", "macos-14", "macos-13"]' + os: ${{ matrix.os }} build_macos_free_threading: name: 'macOS (free-threading)' needs: check_source if: needs.check_source.outputs.run_tests == 'true' + strategy: + fail-fast: false + matrix: + # Cirrus and macos-14 are M1. + # Cirrus used for upstream, macos-14 for forks. + os: + - ghcr.io/cirruslabs/macos-runner:sonoma + - macos-14 + is-fork: # only used for the exclusion trick + - ${{ github.repository_owner != 'python' }} + exclude: + - os: ghcr.io/cirruslabs/macos-runner:sonoma + is-fork: true + - os: macos-14 + is-fork: false uses: ./.github/workflows/reusable-macos.yml with: config_hash: ${{ needs.check_source.outputs.config_hash }} free-threading: true - # Cirrus and macos-14 are M1. - # Cirrus used for upstream, macos-14 for forks. - os-matrix: '["ghcr.io/cirruslabs/macos-runner:sonoma", "macos-14"]' + os: ${{ matrix.os }} build_ubuntu: name: 'Ubuntu' diff --git a/.github/workflows/reusable-macos.yml b/.github/workflows/reusable-macos.yml index f825d1a7b3f69a..335b969b614649 100644 --- a/.github/workflows/reusable-macos.yml +++ b/.github/workflows/reusable-macos.yml @@ -8,13 +8,14 @@ on: required: false type: boolean default: false - os-matrix: - required: false + os: + description: OS to run the job in + required: true type: string jobs: build_macos: - name: build and test (${{ matrix.os }}) + name: build and test (${{ inputs.os }}) timeout-minutes: 60 env: HOMEBREW_NO_ANALYTICS: 1 @@ -23,18 +24,7 @@ jobs: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 PYTHONSTRICTEXTENSIONBUILD: 1 TERM: linux - strategy: - fail-fast: false - matrix: - os: ${{fromJson(inputs.os-matrix)}} - is-fork: - - ${{ github.repository_owner != 'python' }} - exclude: - - os: "ghcr.io/cirruslabs/macos-runner:sonoma" - is-fork: true - - os: "macos-14" - is-fork: false - runs-on: ${{ matrix.os }} + runs-on: ${{ inputs.os }} steps: - uses: actions/checkout@v4 - name: Runner image version @@ -43,7 +33,7 @@ jobs: uses: actions/cache@v4 with: path: config.cache - key: ${{ github.job }}-${{ matrix.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }} + key: ${{ github.job }}-${{ inputs.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }} - name: Install Homebrew dependencies run: brew install pkg-config openssl@3.0 xz gdbm tcl-tk - name: Configure CPython From 2e1632ed113813cc106fad62f79630f356704663 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Mon, 15 Jul 2024 20:51:23 +0200 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=A7=AA=F0=9F=92=85=20Merge=20GIL=20an?= =?UTF-8?q?d=20no-GIL=20macOS=20CI=20definitions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is a DRY exercise, they were almost the same and there is no reason to keep them separate in YAML. --- .github/workflows/build.yml | 38 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5fdfbb95de0e62..160a517aef9801 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -199,13 +199,16 @@ jobs: free-threading: ${{ matrix.free-threading }} build_macos: - name: 'macOS' + name: >- + macOS + ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} needs: check_source if: needs.check_source.outputs.run_tests == 'true' strategy: fail-fast: false matrix: # Cirrus and macos-14 are M1, macos-13 is default GHA Intel. + # macOS 13 only runs tests against the GIL-enabled CPython. # Cirrus used for upstream, macos-14 for forks. os: - ghcr.io/cirruslabs/macos-runner:sonoma @@ -213,39 +216,20 @@ jobs: - macos-13 is-fork: # only used for the exclusion trick - ${{ github.repository_owner != 'python' }} + free-threading: + - false + - true exclude: - os: ghcr.io/cirruslabs/macos-runner:sonoma is-fork: true - os: macos-14 is-fork: false + - os: macos-13 + free-threading: true uses: ./.github/workflows/reusable-macos.yml with: config_hash: ${{ needs.check_source.outputs.config_hash }} - os: ${{ matrix.os }} - - build_macos_free_threading: - name: 'macOS (free-threading)' - needs: check_source - if: needs.check_source.outputs.run_tests == 'true' - strategy: - fail-fast: false - matrix: - # Cirrus and macos-14 are M1. - # Cirrus used for upstream, macos-14 for forks. - os: - - ghcr.io/cirruslabs/macos-runner:sonoma - - macos-14 - is-fork: # only used for the exclusion trick - - ${{ github.repository_owner != 'python' }} - exclude: - - os: ghcr.io/cirruslabs/macos-runner:sonoma - is-fork: true - - os: macos-14 - is-fork: false - uses: ./.github/workflows/reusable-macos.yml - with: - config_hash: ${{ needs.check_source.outputs.config_hash }} - free-threading: true + free-threading: ${{ matrix.free-threading }} os: ${{ matrix.os }} build_ubuntu: @@ -583,7 +567,6 @@ jobs: - check-docs - check_generated_files - build_macos - - build_macos_free_threading - build_ubuntu - build_ubuntu_free_threading - build_ubuntu_ssltests @@ -618,7 +601,6 @@ jobs: && ' check_generated_files, build_macos, - build_macos_free_threading, build_ubuntu, build_ubuntu_free_threading, build_ubuntu_ssltests, From 655b8757a3a2dd8206bf4bb6d75750b6ad50b0f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sviatoslav=20Sydorenko=20=28=D0=A1=D0=B2=D1=8F=D1=82=D0=BE?= =?UTF-8?q?=D1=81=D0=BB=D0=B0=D0=B2=20=D0=A1=D0=B8=D0=B4=D0=BE=D1=80=D0=B5?= =?UTF-8?q?=D0=BD=D0=BA=D0=BE=29?= Date: Thu, 25 Jul 2024 20:12:13 +0200 Subject: [PATCH 3/3] Rephrase the os input description Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- .github/workflows/reusable-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-macos.yml b/.github/workflows/reusable-macos.yml index 335b969b614649..eef6be75003e83 100644 --- a/.github/workflows/reusable-macos.yml +++ b/.github/workflows/reusable-macos.yml @@ -9,7 +9,7 @@ on: type: boolean default: false os: - description: OS to run the job in + description: OS to run the job required: true type: string