[CI] Make building static/shared configurable (#8272)
authorAndres Noetzli <andres.noetzli@gmail.com>
Fri, 11 Mar 2022 14:48:39 +0000 (06:48 -0800)
committerGitHub <noreply@github.com>
Fri, 11 Mar 2022 14:48:39 +0000 (14:48 +0000)
This commit changes our CI workflow to actually pass through
build-shared and build-static to the configure-and-build action
and fixes how the condition is checked there. If we just pass through
the inputs, then the condition "${{ inputs.build-shared }}" != "true"
would be true (i.e., the step would be skipped) if
build-shared/build-static are not set explicitly in ci.yml because
of the default values for build-shared/build-static in ci.yml.

.github/actions/configure-and-build/action.yml
.github/workflows/ci.yml

index ace887be17b486f9b378011f07b34c54a8e8b77e..1f3ab5fc909cd0c74fbccc1ce931a5dd9a4bb1b9 100644 (file)
@@ -7,8 +7,10 @@ inputs:
     default: ""
   build-shared:
     default: true
+    type: boolean
   build-static:
     default: true
+    type: boolean
 outputs:
   shared-build-dir:
     description: build directory of the shared build
@@ -21,10 +23,12 @@ runs:
   steps:
     - name: Shared build
       id: shared-build
+      # Boolean inputs are actually strings:
+      # https://github.com/actions/runner/issues/1483
+      if: inputs.build-shared == '' || inputs.build-shared == 'true'
       shell: bash
       run: |
         echo "::group::Shared build"
-        if [[ "${{ inputs.build-shared }}" != "true" ]]; then exit 0; fi
         ${{ inputs.configure-env }} ./configure.sh ${{ inputs.configure-config }} \
           --prefix=$(pwd)/build-shared/install --werror --name=build-shared
         
@@ -39,10 +43,12 @@ runs:
 
     - name: Static build
       id: static-build
+      # Boolean inputs are actually strings:
+      # https://github.com/actions/runner/issues/1483
+      if: inputs.build-static == '' || inputs.build-static == 'true'
       shell: bash
       run: |
         echo "::group::Static build"
-        if [[ "${{ inputs.build-static }}" != "true" ]]; then exit 0; fi
         ${{ inputs.configure-env }} ./configure.sh ${{ inputs.configure-config }} \
           --prefix=$(pwd)/build-static/install --werror --static --name=build-static --no-java-bindings
 
index 3e9c470fed1867750dbb49886f0d162d0158c80d..543641042887ef26b91ae8a764068ed269f68749 100644 (file)
@@ -75,6 +75,8 @@ jobs:
       with:
         configure-env: ${{ matrix.env }}
         configure-config: ${{ matrix.config }}
+        build-shared: ${{ matrix.build-shared }}
+        build-static: ${{ matrix.build-static }}
 
     - name: ccache Statistics
       run: ccache -s