Skip to content

Commit 86c7477

Browse files
committed
git-artifacts: extend the SKIP logic to handle pkg and build-arm64
When the user asked for `installer-x86_64`, there is no point in building `pkg-i686` or `build-arm64`; Let's be a bit smarter about this. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 203c8d8 commit 86c7477

File tree

1 file changed

+46
-4
lines changed

1 file changed

+46
-4
lines changed

.github/workflows/git-artifacts.yml

+46-4
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,21 @@ jobs:
140140
bitness: 32
141141
bin: ''
142142
steps:
143+
- name: Determine whether this job should be skipped
144+
shell: bash
145+
run: |
146+
for e in ${BUILD_ONLY:-pkg}
147+
do
148+
case $e in
149+
*-${{matrix.arch.name}}) exit 0;; # build this artifact
150+
*-arm64) test i686 != ${{matrix.arch.name}} || exit 0;; # pkg-i686 is required for the ARM64 version
151+
*-*) ;; # not this build artifact, keep looking
152+
*) exit 0;; # build this artifact
153+
esac
154+
done
155+
echo "SKIP=true" >>$GITHUB_ENV
143156
- name: Configure user
157+
if: env.SKIP != 'true'
144158
shell: bash
145159
run:
146160
USER_NAME="${{github.actor}}" &&
@@ -150,13 +164,14 @@ jobs:
150164
git config --global user.email "$USER_EMAIL" &&
151165
echo "PACKAGER=$USER_NAME <$USER_EMAIL>" >>$GITHUB_ENV
152166
- name: Cache git-sdk-64-build-installers
167+
if: env.SKIP != 'true'
153168
id: cache-sdk-build-installers
154169
uses: actions/cache@v2
155170
with:
156171
path: git-sdk-64-build-installers
157172
key: build-installers-64-${{ needs.bundle-artifacts.outputs.latest-sdk64-extra-build-id }}
158173
- name: Download git-sdk-64-build-installers
159-
if: steps.cache-sdk-build-installers.outputs.cache-hit != 'true'
174+
if: env.SKIP != 'true' && steps.cache-sdk-build-installers.outputs.cache-hit != 'true'
160175
shell: bash
161176
run: |
162177
# Use Git Bash to download and unpack the artifact
@@ -172,11 +187,13 @@ jobs:
172187
## Unpack artifact
173188
unzip artifacts.zip
174189
- name: Download bundle-artifacts
190+
if: env.SKIP != 'true'
175191
uses: actions/download-artifact@v1
176192
with:
177193
name: bundle-artifacts
178194
path: bundle-artifacts
179195
- name: Clone and update build-extra
196+
if: env.SKIP != 'true'
180197
shell: bash
181198
run: |
182199
d=git-sdk-64-build-installers/usr/src/build-extra &&
@@ -189,6 +206,7 @@ jobs:
189206
fi &&
190207
git -C $d pull "$PWD"/bundle-artifacts/build-extra.bundle main
191208
- name: Check out git/git
209+
if: env.SKIP != 'true'
192210
shell: bash
193211
run: |
194212
git -c init.defaultBranch=main init &&
@@ -199,7 +217,7 @@ jobs:
199217
env:
200218
CODESIGN_P12: ${{secrets.CODESIGN_P12}}
201219
CODESIGN_PASS: ${{secrets.CODESIGN_PASS}}
202-
if: env.CODESIGN_P12 != '' && env.CODESIGN_PASS != ''
220+
if: env.SKIP != 'true' && env.CODESIGN_P12 != '' && env.CODESIGN_PASS != ''
203221
shell: bash
204222
run: |
205223
cd home &&
@@ -208,7 +226,7 @@ jobs:
208226
echo -n "$CODESIGN_PASS" >.sig/codesign.pass
209227
git config --global alias.signtool '!sh "/usr/src/build-extra/signtool.sh"'
210228
- name: Prepare home directory for GPG signing
211-
if: env.GPGKEY != ''
229+
if: env.SKIP != 'true' && env.GPGKEY != ''
212230
shell: bash
213231
run: |
214232
echo '${{secrets.PRIVGPGKEY}}' | tr % '\n' | gpg $GPG_OPTIONS --import &&
@@ -218,6 +236,7 @@ jobs:
218236
env:
219237
GPGKEY: ${{secrets.GPGKEY}}
220238
- name: Build mingw-w64-${{matrix.arch.name}}-git
239+
if: env.SKIP != 'true'
221240
env:
222241
GPGKEY: "${{secrets.GPGKEY}}"
223242
shell: powershell
@@ -247,10 +266,11 @@ jobs:
247266
git bundle create \"`$b\"/MINGW-packages.bundle origin/main..main)
248267
"@
249268
- name: Clean up temporary files
250-
if: always()
269+
if: always() && env.SKIP != 'true'
251270
shell: bash
252271
run: rm -rf home
253272
- name: Publish mingw-w64-${{matrix.arch.name}}-git
273+
if: env.SKIP != 'true'
254274
uses: actions/upload-artifact@v1
255275
with:
256276
name: pkg-${{matrix.arch.name}}
@@ -259,7 +279,20 @@ jobs:
259279
needs: bundle-artifacts
260280
runs-on: windows-latest
261281
steps:
282+
- name: Determine whether this job should be skipped
283+
shell: bash
284+
run: |
285+
for e in ${BUILD_ONLY:-pkg}
286+
do
287+
case $e in
288+
*-arm64) exit 0;; # build this artifact
289+
*-*) ;; # not this build artifact, keep looking
290+
*) exit 0;; # build this artifact
291+
esac
292+
done
293+
echo "SKIP=true" >>$GITHUB_ENV
262294
- name: Configure user
295+
if: env.SKIP != 'true'
263296
shell: bash
264297
run:
265298
USER_NAME="${{github.actor}}" &&
@@ -268,34 +301,43 @@ jobs:
268301
git config --global user.name "$USER_NAME" &&
269302
git config --global user.email "$USER_EMAIL"
270303
- uses: actions/checkout@v2
304+
if: env.SKIP != 'true'
271305
- name: initialize vcpkg
306+
if: env.SKIP != 'true'
272307
uses: actions/checkout@v2
273308
with:
274309
repository: 'microsoft/vcpkg'
275310
path: 'compat/vcbuild/vcpkg'
276311
- name: download vcpkg artifacts
312+
if: env.SKIP != 'true'
277313
uses: git-for-windows/get-azure-pipelines-artifact@v0
278314
with:
279315
repository: git/git
280316
definitionId: 9
281317
- name: add msbuild to PATH
318+
if: env.SKIP != 'true'
282319
uses: microsoft/setup-msbuild@v1
283320
- name: copy dlls to root
321+
if: env.SKIP != 'true'
284322
shell: powershell
285323
run: |
286324
& compat\vcbuild\vcpkg_copy_dlls.bat release arm64-windows
287325
if (!$?) { exit(1) }
288326
- name: generate Visual Studio solution
327+
if: env.SKIP != 'true'
289328
shell: bash
290329
run: |
291330
cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/arm64-windows \
292331
-DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON -DCMAKE_GENERATOR_PLATFORM=arm64 -DVCPKG_ARCH=arm64-windows \
293332
-DCMAKE_INSTALL_PREFIX="`pwd`/git-arm64" -DSKIP_DASHED_BUILT_INS=ON
294333
- name: MSBuild
334+
if: env.SKIP != 'true'
295335
run: msbuild git.sln -property:Configuration=Release
296336
- name: Link the Git executables
337+
if: env.SKIP != 'true'
297338
run: msbuild INSTALL.vcxproj -property:Configuration=Release
298339
- name: upload build artifacts
340+
if: env.SKIP != 'true'
299341
uses: actions/upload-artifact@v1
300342
with:
301343
name: arm64-artifacts

0 commit comments

Comments
 (0)