]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
🧪🚑 Fix using `check_source` flags as bool (#121848)
authorSviatoslav Sydorenko (Святослав Сидоренко) <wk@sydorenko.org.ua>
Tue, 16 Jul 2024 12:50:30 +0000 (14:50 +0200)
committerGitHub <noreply@github.com>
Tue, 16 Jul 2024 12:50:30 +0000 (12:50 +0000)
.github/workflows/build.yml
.github/workflows/reusable-windows.yml

index e1d9e1632f136ca6230a6c8879356b457c9a705d..0298d0467fe35f0c9ff61950013005be7eb7c409 100644 (file)
@@ -27,11 +27,31 @@ jobs:
     runs-on: ubuntu-latest
     timeout-minutes: 10
     outputs:
+      # Some of the referenced steps set outputs conditionally and there may be
+      # cases when referencing them evaluates to empty strings. It is nice to
+      # work with proper booleans so they have to be evaluated through JSON
+      # conversion in the expressions. However, empty strings used like that
+      # may trigger all sorts of undefined and hard-to-debug behaviors in
+      # GitHub Actions CI/CD. To help with this, all of the outputs set here
+      # that are meant to be used as boolean flags (and not arbitrary strings),
+      # MUST have fallbacks with default values set. A common pattern would be
+      # to add ` || false` to all such expressions here, in the output
+      # definitions. They can then later be safely used through the following
+      # idiom in job conditionals and other expressions. Here's some examples:
+      #
+      #   if: fromJSON(needs.check_source.outputs.run-docs)
+      #
+      #   ${{
+      #        fromJSON(needs.check_source.outputs.run_tests)
+      #        && 'truthy-branch'
+      #        || 'falsy-branch'
+      #   }}
+      #
       run-docs: ${{ steps.docs-changes.outputs.run-docs || false }}
-      run_tests: ${{ steps.check.outputs.run_tests }}
-      run_hypothesis: ${{ steps.check.outputs.run_hypothesis }}
-      run_cifuzz: ${{ steps.check.outputs.run_cifuzz }}
-      config_hash: ${{ steps.config_hash.outputs.hash }}
+      run_tests: ${{ steps.check.outputs.run_tests || false }}
+      run_hypothesis: ${{ steps.check.outputs.run_hypothesis || false }}
+      run_cifuzz: ${{ steps.check.outputs.run_cifuzz || false }}
+      config_hash: ${{ steps.config_hash.outputs.hash }}  # str
     steps:
       - uses: actions/checkout@v4
       - name: Check for source changes
index 94a3abe530cb9b54667e0c0758826bba34846150..e9c3c8e05a801c47e2f2cddf7fe1e0b19a244d5c 100644 (file)
@@ -6,7 +6,7 @@ on:
         required: true
         type: string
       free-threading:
-        description: Whether to use no-GIL mode
+        description: Whether to compile CPython in free-threading mode
         required: false
         type: boolean
         default: false