Skip to content

Commit be6f653

Browse files
Update publish-go-nightly-task using parallelization
Introducing the use of a matrix, greatly improves time performances during the build making process, since each build task is performed simultaneously. The calculation of the checksums has also been modified. Previously, it was done three (3) times at different stages of the workflow. This is pointless, since the only checksums that matter are the ones calculated when the files are in their final form. For this reason, it is now only done once during the release creation.
1 parent 0dd9d8f commit be6f653

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

workflow-templates/publish-go-nightly-task.yml

+21-18
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ jobs:
2222
create-nightly-artifacts:
2323
runs-on: ubuntu-latest
2424

25+
strategy:
26+
matrix:
27+
os:
28+
- Windows_32bit
29+
- Windows_64bit
30+
- Linux_32bit
31+
- Linux_64bit
32+
- Linux_ARMv6
33+
- Linux_ARMv7
34+
- Linux_ARM64
35+
- macOS_64bit
36+
- macOS_ARM64
37+
2538
steps:
2639
- name: Checkout repository
2740
uses: actions/checkout@v3
@@ -35,7 +48,7 @@ jobs:
3548
- name: Build
3649
env:
3750
NIGHTLY: true
38-
run: task dist:all
51+
run: task dist:${{ matrix.os }}
3952

4053
- name: Upload artifacts
4154
uses: actions/upload-artifact@v3
@@ -128,14 +141,10 @@ jobs:
128141
run: |
129142
gon "${{ env.GON_CONFIG_PATH }}"
130143
131-
- name: Re-package binary and output checksum
144+
- name: Re-package binary
132145
id: re-package
133146
working-directory: ${{ env.DIST_DIR }}
134-
# This step performs the following:
135-
# 1. Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
136-
# 2. Recalculate package checksum
137-
# 3. Output the new checksum to include in the nnnnnn-checksums.txt file
138-
# (it cannot be done there because of workflow job parallelization)
147+
# Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
139148
run: |
140149
# GitHub's upload/download-artifact actions don't preserve file permissions,
141150
# so we need to add execution permission back until the action is made to do this.
@@ -145,11 +154,9 @@ jobs:
145154
tar -czvf "$PACKAGE_FILENAME" \
146155
-C "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/" "${{ env.PROJECT_NAME }}" \
147156
-C ../../ LICENSE.txt
148-
CHECKSUM_LINE="$(shasum -a 256 $PACKAGE_FILENAME)"
149157
echo "PACKAGE_FILENAME=$PACKAGE_FILENAME" >> $GITHUB_ENV
150-
echo "::set-output name=checksum-${{ matrix.artifact.name }}::$CHECKSUM_LINE"
151158
152-
- name: Upload artifacts
159+
- name: Upload artifact
153160
uses: actions/upload-artifact@v3
154161
with:
155162
if-no-files-found: error
@@ -167,15 +174,11 @@ jobs:
167174
name: ${{ env.ARTIFACT_NAME }}
168175
path: ${{ env.DIST_DIR }}
169176

170-
- name: Update checksum
177+
- name: Create checksum file
178+
working-directory: ${{ env.DIST_DIR}}
171179
run: |
172-
declare -a checksum_lines=("${{ needs.notarize-macos.outputs.checksum-darwin_amd64 }}" "${{ needs.notarize-macos.outputs.checksum-darwin_arm64 }}")
173-
for checksum_line in "${checksum_lines[@]}"
174-
do
175-
CHECKSUM=$(echo ${checksum_line} | cut -d " " -f 1)
176-
PACKAGE_FILENAME=$(echo ${checksum_line} | cut -d " " -f 2)
177-
perl -pi -w -e "s/.*${PACKAGE_FILENAME}/${CHECKSUM} ${PACKAGE_FILENAME}/g;" ${{ env.DIST_DIR }}/*-checksums.txt
178-
done
180+
TAG="nightly-$(date -u +"%Y%m%d")"
181+
sha256sum ${{ env.PROJECT_NAME }}_${TAG}* > ${TAG}-checksums.txt
179182
180183
- name: Upload release files on Arduino downloads servers
181184
uses: docker://plugins/s3

0 commit comments

Comments
 (0)