From f8c44ed825415b746703be69c1dfb58332ed6cc4 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 14 Jul 2024 12:42:51 +0200 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=A7=AA=F0=9F=92=85Evaluate=20`free-th?= =?UTF-8?q?reading`=20var=20as=20JSON=20@=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sometimes, GitHub Actions turn things into strings when passing the data around. So it's usually safer to turn them into proper booleans in expressions explicitly. --- .github/workflows/build.yml | 4 ++-- .github/workflows/reusable-windows.yml | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 58328096faef40..bc60799546f0b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -181,13 +181,13 @@ jobs: build_windows: name: 'Windows' needs: check_source - if: needs.check_source.outputs.run_tests == 'true' + if: fromJSON(needs.check_source.outputs.run_tests) uses: ./.github/workflows/reusable-windows.yml build_windows_free_threading: name: 'Windows (free-threading)' needs: check_source - if: needs.check_source.outputs.run_tests == 'true' + if: fromJSON(needs.check_source.outputs.run_tests) uses: ./.github/workflows/reusable-windows.yml with: free-threading: true diff --git a/.github/workflows/reusable-windows.yml b/.github/workflows/reusable-windows.yml index c0209e0e1c92e9..6e43d0d8fddffb 100644 --- a/.github/workflows/reusable-windows.yml +++ b/.github/workflows/reusable-windows.yml @@ -16,11 +16,11 @@ jobs: steps: - uses: actions/checkout@v4 - name: Build CPython - run: .\PCbuild\build.bat -e -d -v -p Win32 ${{ inputs.free-threading && '--disable-gil' || '' }} + run: .\PCbuild\build.bat -e -d -v -p Win32 ${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }} - name: Display build info run: .\python.bat -m test.pythoninfo - name: Tests - run: .\PCbuild\rt.bat -p Win32 -d -q --fast-ci ${{ inputs.free-threading && '--disable-gil' || '' }} + run: .\PCbuild\rt.bat -p Win32 -d -q --fast-ci ${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }} build_win_amd64: name: 'build and test (x64)' @@ -33,11 +33,11 @@ jobs: - name: Register MSVC problem matcher run: echo "::add-matcher::.github/problem-matchers/msvc.json" - name: Build CPython - run: .\PCbuild\build.bat -e -d -v -p x64 ${{ inputs.free-threading && '--disable-gil' || '' }} + run: .\PCbuild\build.bat -e -d -v -p x64 ${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }} - name: Display build info run: .\python.bat -m test.pythoninfo - name: Tests - run: .\PCbuild\rt.bat -p x64 -d -q --fast-ci ${{ inputs.free-threading && '--disable-gil' || '' }} + run: .\PCbuild\rt.bat -p x64 -d -q --fast-ci ${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }} build_win_arm64: name: 'build (arm64)' @@ -50,4 +50,4 @@ jobs: - name: Register MSVC problem matcher run: echo "::add-matcher::.github/problem-matchers/msvc.json" - name: Build CPython - run: .\PCbuild\build.bat -e -d -v -p arm64 ${{ inputs.free-threading && '--disable-gil' || '' }} + run: .\PCbuild\build.bat -e -d -v -p arm64 ${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }} From c2bd0ed6a0de5b7b6bc6cef0e6427c0f2379c5ba Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 14 Jul 2024 14:24:47 +0200 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=A7=AA=F0=9F=92=85=20Describe=20`free?= =?UTF-8?q?-threading`=20workflow=20input?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, it didn't have a human-readable explanation which is a bad tone as it's less obvious how it's supposed to be used. --- .github/workflows/reusable-windows.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/reusable-windows.yml b/.github/workflows/reusable-windows.yml index 6e43d0d8fddffb..b1bb09257bae83 100644 --- a/.github/workflows/reusable-windows.yml +++ b/.github/workflows/reusable-windows.yml @@ -2,6 +2,7 @@ on: workflow_call: inputs: free-threading: + description: Whether to use no-GIL mode required: false type: boolean default: false From 4579407f594d50a486d031f04ce04f09d1548ffd Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 14 Jul 2024 14:29:52 +0200 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=A7=AA=F0=9F=92=85=20Mv=20`reusable-w?= =?UTF-8?q?indows`=20workflow=20`env`=20to=20top?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, it was duplicated in each job which is not DRY. --- .github/workflows/reusable-windows.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/reusable-windows.yml b/.github/workflows/reusable-windows.yml index b1bb09257bae83..68442025a084e6 100644 --- a/.github/workflows/reusable-windows.yml +++ b/.github/workflows/reusable-windows.yml @@ -7,13 +7,15 @@ on: type: boolean default: false +env: + IncludeUwp: >- + true + jobs: build_win32: name: 'build and test (x86)' runs-on: windows-latest timeout-minutes: 60 - env: - IncludeUwp: 'true' steps: - uses: actions/checkout@v4 - name: Build CPython @@ -27,8 +29,6 @@ jobs: name: 'build and test (x64)' runs-on: windows-latest timeout-minutes: 60 - env: - IncludeUwp: 'true' steps: - uses: actions/checkout@v4 - name: Register MSVC problem matcher @@ -44,8 +44,6 @@ jobs: name: 'build (arm64)' runs-on: windows-latest timeout-minutes: 60 - env: - IncludeUwp: 'true' steps: - uses: actions/checkout@v4 - name: Register MSVC problem matcher From a66b4a00e1cff7a8174dd0dde195a01779ff18be Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 14 Jul 2024 14:42:27 +0200 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=A7=AA=F0=9F=92=85=20Mv=20reusable-wi?= =?UTF-8?q?ndows=20arch=20matrix=20outside?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, the reusable windows workflow defined a number of per-arch jobs with a lot of copy-paste. Now, there is a single job and a matrix definition on the calling side. --- .github/workflows/build.yml | 15 ++++++++ .github/workflows/reusable-windows.yml | 49 +++++++++++--------------- 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc60799546f0b4..190a6cf6b31b55 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -182,14 +182,29 @@ jobs: name: 'Windows' needs: check_source if: fromJSON(needs.check_source.outputs.run_tests) + strategy: + matrix: + arch: + - Win32 + - x64 + - arm64 uses: ./.github/workflows/reusable-windows.yml + with: + arch: ${{ matrix.arch }} build_windows_free_threading: name: 'Windows (free-threading)' needs: check_source if: fromJSON(needs.check_source.outputs.run_tests) + strategy: + matrix: + arch: + - Win32 + - x64 + - arm64 uses: ./.github/workflows/reusable-windows.yml with: + arch: ${{ matrix.arch }} free-threading: true build_macos: diff --git a/.github/workflows/reusable-windows.yml b/.github/workflows/reusable-windows.yml index 68442025a084e6..94a3abe530cb9b 100644 --- a/.github/workflows/reusable-windows.yml +++ b/.github/workflows/reusable-windows.yml @@ -1,6 +1,10 @@ on: workflow_call: inputs: + arch: + description: CPU architecture + required: true + type: string free-threading: description: Whether to use no-GIL mode required: false @@ -12,41 +16,30 @@ env: true jobs: - build_win32: - name: 'build and test (x86)' - runs-on: windows-latest - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - - name: Build CPython - run: .\PCbuild\build.bat -e -d -v -p Win32 ${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }} - - name: Display build info - run: .\python.bat -m test.pythoninfo - - name: Tests - run: .\PCbuild\rt.bat -p Win32 -d -q --fast-ci ${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }} - - build_win_amd64: - name: 'build and test (x64)' + build: + name: >- + build${{ inputs.arch != 'arm64' && ' and test' || '' }} + (${{ inputs.arch }}) runs-on: windows-latest timeout-minutes: 60 steps: - uses: actions/checkout@v4 - name: Register MSVC problem matcher + if: inputs.arch != 'Win32' run: echo "::add-matcher::.github/problem-matchers/msvc.json" - name: Build CPython - run: .\PCbuild\build.bat -e -d -v -p x64 ${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }} + run: >- + .\PCbuild\build.bat + -e -d -v + -p ${{ inputs.arch }} + ${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }} - name: Display build info + if: inputs.arch != 'arm64' run: .\python.bat -m test.pythoninfo - name: Tests - run: .\PCbuild\rt.bat -p x64 -d -q --fast-ci ${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }} - - build_win_arm64: - name: 'build (arm64)' - runs-on: windows-latest - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - - name: Register MSVC problem matcher - run: echo "::add-matcher::.github/problem-matchers/msvc.json" - - name: Build CPython - run: .\PCbuild\build.bat -e -d -v -p arm64 ${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }} + if: inputs.arch != 'arm64' + run: >- + .\PCbuild\rt.bat + -p ${{ inputs.arch }} + -d -q --fast-ci + ${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }} From 21a36a299cda85cdd8745a19c605ae74787d04dd Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sun, 14 Jul 2024 14:48:57 +0200 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=A7=AA=F0=9F=92=85=20Melt=20(non-)fre?= =?UTF-8?q?e-threading=20Win=20jobs=20a=20matrix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, these were defined through two separate matrices but there is no technical reason to keep them like that. --- .github/workflows/build.yml | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 190a6cf6b31b55..e1d9e1632f136c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -179,7 +179,9 @@ jobs: run: make check-c-globals build_windows: - name: 'Windows' + name: >- + Windows + ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} needs: check_source if: fromJSON(needs.check_source.outputs.run_tests) strategy: @@ -188,24 +190,13 @@ jobs: - Win32 - x64 - arm64 + free-threading: + - false + - true uses: ./.github/workflows/reusable-windows.yml with: arch: ${{ matrix.arch }} - - build_windows_free_threading: - name: 'Windows (free-threading)' - needs: check_source - if: fromJSON(needs.check_source.outputs.run_tests) - strategy: - matrix: - arch: - - Win32 - - x64 - - arm64 - uses: ./.github/workflows/reusable-windows.yml - with: - arch: ${{ matrix.arch }} - free-threading: true + free-threading: ${{ matrix.free-threading }} build_macos: name: 'macOS' @@ -571,7 +562,6 @@ jobs: - build_ubuntu_ssltests - build_wasi - build_windows - - build_windows_free_threading - test_hypothesis - build_asan - build_tsan @@ -607,7 +597,6 @@ jobs: build_ubuntu_ssltests, build_wasi, build_windows, - build_windows_free_threading, build_asan, build_tsan, build_tsan_free_threading,