Skip to content

Commit 4752247

Browse files
fix: process artifacts using strategy matrix (#66)
1 parent 5a0b25e commit 4752247

1 file changed

Lines changed: 33 additions & 20 deletions

File tree

.github/workflows/copr-ci.yml

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ jobs:
167167
BUILD_CANCEL: ${{ steps.build.outcome == 'cancelled' }}
168168
BUILD_SUCCESS: ${{ steps.build.outcome == 'success' }}
169169
CHROOTS: ${{ steps.chroots.outputs.CHROOTS }}
170+
CHROOTS_MATRIX: ${{ steps.chroots.outputs.CHROOTS_MATRIX }}
170171
runs-on: ubuntu-latest
171172
permissions:
172173
contents: read
@@ -258,11 +259,16 @@ jobs:
258259
echo "chroots:"
259260
echo "${chroots}"
260261
262+
# Create matrix JSON array
263+
chroots_matrix=$(echo "${chroots}" | jq -R -s -c 'split("\n") | map(select(length > 0))')
264+
echo "chroots_matrix: ${chroots_matrix}"
265+
261266
{
262267
echo "BUILD_ID_ALT=${build_id_alt}"
263268
echo "CHROOTS<<EOF" # use heredoc for multiline output
264269
echo "${chroots}"
265270
echo "EOF"
271+
echo "CHROOTS_MATRIX=${chroots_matrix}"
266272
} >> "${GITHUB_OUTPUT}"
267273
268274
- name: Cancel Copr build
@@ -361,12 +367,16 @@ jobs:
361367
exit ${error}
362368
363369
artifacts:
364-
name: Artifacts
370+
name: Artifacts (${{ matrix.chroot }})
365371
if: always() && needs.build.outputs.BUILD_SUCCESS == 'true'
366372
container: fedora:latest
373+
strategy:
374+
max-parallel: 2
375+
matrix:
376+
chroot: ${{ fromJson(needs.build.outputs.CHROOTS_MATRIX) }}
367377
env:
368378
BUILD_ID: ${{ needs.build.outputs.BUILD_ID }}
369-
CHROOTS: ${{ needs.build.outputs.CHROOTS }}
379+
CHROOT: ${{ matrix.chroot }}
370380
needs: build
371381
runs-on: ubuntu-latest
372382
permissions:
@@ -389,22 +399,25 @@ jobs:
389399
mkdir -p artifacts
390400
cd artifacts
391401
392-
for chroot in ${CHROOTS}; do
393-
echo "==> Downloading artifacts for chroot: ${chroot}"
394-
copr-cli \
395-
--debug \
396-
download-build \
397-
--chroot "${chroot}" \
398-
--dest . \
399-
--rpms \
400-
"${BUILD_ID}"
401-
402-
find . -type f -name "*.rpm" ! -name "*.src.rpm" | while read -r file; do
403-
name=build-$(basename "$file")
404-
echo "Uploading $name, file: $file"
405-
zip -j - "$file" | gh-actions-artifact-client.js upload "${name}" --retentionDays=7
406-
407-
# empty artifacts directory to free up runner space
408-
rm -rf ./*
409-
done
402+
echo "==> Downloading artifacts for chroot: ${CHROOT}"
403+
copr-cli \
404+
--debug \
405+
download-build \
406+
--chroot "${CHROOT}" \
407+
--dest . \
408+
--rpms \
409+
"${BUILD_ID}"
410+
411+
find . -type f -name "*.rpm" ! -name "*.src.rpm" | while read -r file; do
412+
name=build-$(basename "$file")
413+
echo "Uploading $name, file: $file"
414+
zip -j - "$file" | gh-actions-artifact-client.js upload "${name}" --retentionDays=7
410415
done
416+
417+
conclude:
418+
needs: artifacts
419+
permissions: {}
420+
runs-on: ubuntu-latest
421+
steps:
422+
- name: Conclude
423+
run: echo "All tests passed"

0 commit comments

Comments
 (0)