|
31 | 31 | name: Setup CI |
32 | 32 | runs-on: ubuntu-latest |
33 | 33 | env: |
34 | | - # These defaults can be overridden by the inputs (if the trigger is a workflow_dispatch) |
35 | | - OVERRIDE_SPACK_REF: 'releases/v1.1' |
36 | | - OVERRIDE_SPACK_CONFIG_REF: 'main' |
37 | | - OVERRIDE_ACCESS_SPACK_PACKAGES_REF: ${{ github.event.pull_request.head.sha }} |
| 34 | + # Note, this needs to be updated in line with refs in the ci job below |
| 35 | + BUILD_CI_WORKFLOW_VERSION: v3 |
38 | 36 | PACKAGES_ROOT_DIR: spack_repo/access/nri/packages |
39 | 37 | outputs: |
40 | 38 | matrix: ${{ steps.set-matrix.outputs.matrix }} |
@@ -125,13 +123,32 @@ jobs: |
125 | 123 | # Remove the trailing comma and wrap in square brackets |
126 | 124 | echo "matrix=[${json_entries%,}]" >> $GITHUB_OUTPUT |
127 | 125 |
|
| 126 | + - name: Checkout build-ci |
| 127 | + uses: actions/checkout@v4 |
| 128 | + with: |
| 129 | + repository: access-nri/build-ci |
| 130 | + ref: ${{ env.BUILD_CI_WORKFLOW_VERSION }} |
| 131 | + |
| 132 | + - name: Get default refs from build-ci workflow |
| 133 | + id: defaults |
| 134 | + # GitHub does not treat empty-string inputs as eligible for substitution with a default |
| 135 | + # Since we are supporting both workflow_dispatch and pull_request triggers, the entrypoint inputs need to be filled in |
| 136 | + # So we are getting the default values from the workflow file itself, and passing them back into the workflow |
| 137 | + # builtin-spack-packages-ref does not need this as the input handles the empty string default. |
| 138 | + run: | |
| 139 | + default_spack_ref=$(yq '.on.workflow_call.inputs."spack-ref".default' .github/build-ci/workflows/ci.yml) |
| 140 | + spack_config_ref=$(yq '.on.workflow_call.inputs."spack-config-ref".default' .github/build-ci/workflows/ci.yml) |
| 141 | +
|
| 142 | + echo "Default refs from ${{ env.BUILD_CI_WORKFLOW_VERSION }}: spack-ref=$default_spack_ref, spack-config=$spack_config_ref" |
| 143 | +
|
| 144 | +
|
128 | 145 | - name: Set refs |
129 | 146 | id: set-refs |
130 | 147 | run: | |
131 | 148 | echo "builtin-spack-packages-ref=${{ inputs.builtin-spack-packages-ref }}" >> $GITHUB_OUTPUT |
132 | | - echo "access-spack-packages-ref=${{ inputs.access-spack-packages-ref || env.OVERRIDE_ACCESS_SPACK_PACKAGES_REF }}" >> $GITHUB_OUTPUT |
133 | | - echo "spack-config-ref=${{ inputs.spack-config-ref || env.OVERRIDE_SPACK_CONFIG_REF }}" >> $GITHUB_OUTPUT |
134 | | - echo "spack-ref=${{ inputs.spack-ref || env.OVERRIDE_SPACK_REF }}" >> $GITHUB_OUTPUT |
| 149 | + echo "access-spack-packages-ref=${{ inputs.access-spack-packages-ref || github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT |
| 150 | + echo "spack-config-ref=${{ inputs.spack-config-ref || steps.defaults.outputs.spack-config-ref }}" >> $GITHUB_OUTPUT |
| 151 | + echo "spack-ref=${{ inputs.spack-ref || steps.defaults.outputs.spack-ref }}" >> $GITHUB_OUTPUT |
135 | 152 |
|
136 | 153 | ci: |
137 | 154 | name: CI |
|
0 commit comments