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

index cf3e268f0213b94104a79e8b3658874879eef0c3..a3f8ed1e2fe56cef29d9ff0e9ea6764e86ccfc5d 100644 (file)
@@ -35,10 +35,30 @@ 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 }}
-      config_hash: ${{ steps.config_hash.outputs.hash }}
+      run_tests: ${{ steps.check.outputs.run_tests || false }}
+      run_hypothesis: ${{ steps.check.outputs.run_hypothesis || false }}
+      config_hash: ${{ steps.config_hash.outputs.hash }}  # str
     steps:
       - uses: actions/checkout@v4
       - name: Check for source changes
index 41f2c2b0c2cd252187d4f89bd263925e893e6704..de30c980e22f860b733a1802ad3fe36c22827ee2 100644 (file)
@@ -2,6 +2,7 @@ on:
   workflow_call:
     inputs:
       free-threading:
+        description: Whether to compile CPython in free-threading mode
         required: false
         type: boolean
         default: false