7979 uses : actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
8080
8181 - name : Build on Linux
82+ id : build-linux
8283 if : matrix.os == 'ubuntu'
8384 env :
8485 CONFIG : ${{ matrix.CONFIG }}
@@ -109,6 +110,7 @@ jobs:
109110 ./.scripts/run_docker_build.sh
110111
111112 - name : Build on macOS
113+ id : build-macos
112114 if : matrix.os == 'macos'
113115 env :
114116 CONFIG : ${{ matrix.CONFIG }}
@@ -132,13 +134,19 @@ jobs:
132134 ./.scripts/run_osx_build.sh
133135
134136 - name : Build on windows
137+ id : build-windows
138+ if : matrix.os == 'windows'
135139 shell : cmd
136140 run : |
137141 set "flow_run_id=github_%GITHUB_RUN_ID%"
138142 set "remote_url=https://github.com/%GITHUB_REPOSITORY%"
139143 set "sha=%GITHUB_SHA%"
140144 call ".scripts\run_win_build.bat"
141145 env :
146+ # default value; make explicit for now (pending smithy-improvements),
147+ # as it needs to be synchronized with artefact generation below; see
148+ # https://github.com/conda-forge/conda-smithy/issues/2345
149+ CONDA_BLD_DIR : C:\bld
142150 MINIFORGE_HOME : D:\Miniforge
143151 PYTHONUNBUFFERED : 1
144152 CONFIG : ${{ matrix.CONFIG }}
@@ -147,45 +155,72 @@ jobs:
147155 BINSTAR_TOKEN : ${{ secrets.BINSTAR_TOKEN }}
148156 FEEDSTOCK_TOKEN : ${{ secrets.FEEDSTOCK_TOKEN }}
149157 STAGING_BINSTAR_TOKEN : ${{ secrets.STAGING_BINSTAR_TOKEN }}
150- if : matrix.os == 'windows'
158+
159+ - name : Determine build outcome
160+ # this is to merge the status of the linux/osx/win builds into
161+ # something we can easily reuse during artefact generation
162+ id : determine-status
163+ if : ${{ always() }}
164+ shell : bash
165+ env :
166+ OS : ${{ matrix.os }}
167+ run : |
168+ if [[ "$OS" == "ubuntu" ]]; then
169+ STATUS="${{ steps.build-linux.outcome }}"
170+ elif [[ "$OS" == "macos" ]]; then
171+ STATUS="${{ steps.build-macos.outcome }}"
172+ elif [[ "$OS" == "windows" ]]; then
173+ STATUS="${{ steps.build-windows.outcome }}"
174+ fi
175+ if [ -z "$STATUS" ]; then
176+ # jobs that never ran will have empty status
177+ STATUS="cancelled"
178+ fi
179+ echo "status=$STATUS" >> $GITHUB_OUTPUT
180+
151181 - name : Prepare conda build artifacts
182+ continue-on-error : true
152183 id : prepare-artifacts
153184 shell : bash
154- if : ${{ always() }}
185+ # we do not want to trigger artefact creation if the build was cancelled
186+ if : ${{ steps.determine-status.outputs.status != 'cancelled' }}
155187 env :
188+ CI : github_actions
156189 CONFIG : ${{ matrix.CONFIG }}
157190 SHORT_CONFIG : ${{ matrix.SHORT_CONFIG }}
191+ JOB_STATUS : ${{ steps.determine-status.outputs.status }}
158192 OS : ${{ matrix.os }}
159- MINIFORGE_HOME_WIN : D:\Miniforge
160193 run : |
161- export CI=github_actions
162194 export CI_RUN_ID=$GITHUB_RUN_ID
163195 export FEEDSTOCK_NAME="$(basename $GITHUB_REPOSITORY)"
164196 export ARTIFACT_STAGING_DIR="$GITHUB_WORKSPACE"
165197 if [ $OS == "macos" ]; then
166198 export CONDA_BLD_DIR="${MINIFORGE_HOME:-${HOME}/miniforge3}/conda-bld"
167199 elif [ $OS == "windows" ]; then
168- export CONDA_BLD_DIR="${MINIFORGE_HOME_WIN//\\//}/conda-bld"
200+ # this should be populated consistently by smithy, see above
201+ export CONDA_BLD_DIR="C:\\bld"
169202 else
170203 export CONDA_BLD_DIR="build_artifacts"
171204 fi
172205 # Archive everything in CONDA_BLD_DIR except environments
173206 # Archive the CONDA_BLD_DIR environments only when the job fails
174207 # Use different prefix for successful and failed build artifacts
175208 # so random failures don't prevent rebuilds from creating artifacts.
176- JOB_STATUS="${{ job.status }}"
177209 if [ $JOB_STATUS == "failure" ]; then
178210 export BLD_ARTIFACT_PREFIX="conda_artifacts"
179211 export ENV_ARTIFACT_PREFIX="conda_envs"
180212 else
181213 export BLD_ARTIFACT_PREFIX="conda_pkgs"
182214 fi
183- ./.scripts/create_conda_build_artifacts.sh
184- continue-on-error : true
215+ if [ $OS == "windows" ]; then
216+ pwsh -Command ". '.scripts/create_conda_build_artifacts.bat'"
217+ else
218+ ./.scripts/create_conda_build_artifacts.sh
219+ fi
185220
186221 - name : Store conda build artifacts
187222 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
188- if : ${{ always() && steps.prepare-artifacts.outcome == 'success' }}
223+ if : ${{ steps.prepare-artifacts.outcome == 'success' }}
189224 with :
190225 name : ${{ steps.prepare-artifacts.outputs.BLD_ARTIFACT_NAME }}
191226 path : ${{ steps.prepare-artifacts.outputs.BLD_ARTIFACT_PATH }}
@@ -194,7 +229,8 @@ jobs:
194229
195230 - name : Store conda build environment artifacts
196231 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
197- if : ${{ failure() && steps.prepare-artifacts.outcome == 'success' }}
232+ # only relevant if build failed, see above
233+ if : ${{ steps.determine-status.outputs.status == 'failure' && steps.prepare-artifacts.outcome == 'success' }}
198234 with :
199235 name : ${{ steps.prepare-artifacts.outputs.ENV_ARTIFACT_NAME }}
200236 path : ${{ steps.prepare-artifacts.outputs.ENV_ARTIFACT_PATH }}
0 commit comments