Skip to content

Commit b5cc634

Browse files
claudeJoibel
authored andcommitted
perf: parallelize CLI builds in release workflow
Optimize the release workflow by parallelizing the 'make clis' step which builds CLI binaries for 8 different platform/architecture combinations. Changes: - Add build-ui job to build the UI once and share via artifacts - Add build-clis job using matrix strategy to build all 8 CLI variants in parallel - Update publish-release to download pre-built CLI artifacts - Remove sequential 'make clis' step from publish-release This should significantly reduce release build time by running CLI builds concurrently instead of sequentially. Platform/architecture combinations: - linux: amd64, arm64, ppc64le, riscv64, s390x - darwin: amd64, arm64 - windows: amd64
1 parent 6b92af2 commit b5cc634

File tree

1 file changed

+89
-3
lines changed

1 file changed

+89
-3
lines changed

.github/workflows/release.yaml

Lines changed: 89 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,94 @@ jobs:
280280
docker pull quay.io/$image_name
281281
done
282282
283+
build-ui:
284+
name: Build UI
285+
if: github.repository == 'argoproj/argo-workflows'
286+
runs-on: ubuntu-24.04
287+
env:
288+
NODE_OPTIONS: --max-old-space-size=4096
289+
steps:
290+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
291+
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
292+
with:
293+
node-version: "20" # change in all GH Workflows
294+
- name: Restore node packages cache
295+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
296+
with:
297+
path: ui/node_modules
298+
key: ${{ runner.os }}-node-dep-v1-${{ hashFiles('**/yarn.lock') }}
299+
- name: Build UI
300+
run: |
301+
yarn --cwd ui install
302+
yarn --cwd ui build
303+
- name: Upload UI artifact
304+
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
305+
with:
306+
name: ui-dist
307+
path: ui/dist/
308+
309+
build-clis:
310+
name: Build CLI ${{ matrix.goos }}-${{ matrix.goarch }}
311+
if: github.repository == 'argoproj/argo-workflows'
312+
needs: [ build-ui ]
313+
runs-on: ubuntu-24.04
314+
strategy:
315+
matrix:
316+
include:
317+
- goos: linux
318+
goarch: amd64
319+
- goos: linux
320+
goarch: arm64
321+
- goos: linux
322+
goarch: ppc64le
323+
- goos: linux
324+
goarch: riscv64
325+
- goos: linux
326+
goarch: s390x
327+
- goos: darwin
328+
goarch: amd64
329+
- goos: darwin
330+
goarch: arm64
331+
- goos: windows
332+
goarch: amd64
333+
steps:
334+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
335+
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
336+
with:
337+
go-version: "1.24"
338+
- name: Download UI artifact
339+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
340+
with:
341+
name: ui-dist
342+
path: ui/dist/
343+
- name: Set VERSION
344+
run: |
345+
if [ ${GITHUB_REF##*/} = main ]; then
346+
echo "VERSION=latest" >> $GITHUB_ENV
347+
else
348+
echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
349+
fi
350+
- name: Restore Go build cache
351+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
352+
with:
353+
path: ~/.cache/go-build
354+
key: ${{ runner.os }}-go-build-${{ matrix.goos }}-${{ matrix.goarch }}-${{ hashFiles('**/go.sum') }}
355+
restore-keys: |
356+
${{ runner.os }}-go-build-${{ matrix.goos }}-${{ matrix.goarch }}-
357+
- name: Build CLI for ${{ matrix.goos }}-${{ matrix.goarch }}
358+
run: make dist/argo-${{ matrix.goos }}-${{ matrix.goarch }}.gz STATIC_FILES=true VERSION=$VERSION
359+
- name: Upload CLI artifact
360+
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
361+
with:
362+
name: argo-${{ matrix.goos }}-${{ matrix.goarch }}
363+
path: dist/argo-${{ matrix.goos }}-${{ matrix.goarch }}.gz
364+
283365
publish-release:
284366
permissions:
285367
contents: write # for softprops/action-gh-release to create GitHub release
286368
runs-on: ubuntu-24.04
287369
if: github.repository == 'argoproj/argo-workflows'
288-
needs: [ push-images, test-images-linux-amd64, test-images-windows ]
370+
needs: [ push-images, test-images-linux-amd64, test-images-windows, build-clis ]
289371
env:
290372
NODE_OPTIONS: --max-old-space-size=4096
291373
COSIGN_PRIVATE_KEY: ${{secrets.COSIGN_PRIVATE_KEY}}
@@ -317,6 +399,12 @@ jobs:
317399
- run: go install sigs.k8s.io/bom/cmd/[email protected]
318400
- run: go install github.com/spdx/spdx-sbom-generator/cmd/[email protected]
319401
- run: mkdir -p dist
402+
- name: Download CLI artifacts
403+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
404+
with:
405+
pattern: argo-*
406+
path: dist/
407+
merge-multiple: true
320408
- run: generator -o dist -p .
321409
- run: yarn --cwd ui install
322410
- run: generator -o dist -p ui
@@ -332,8 +420,6 @@ jobs:
332420
- name: Print image tag (please check it is not `:latest`)
333421
run: |
334422
grep image: dist/manifests/install.yaml
335-
- run: go mod download
336-
- run: make clis STATIC_FILES=true VERSION=$VERSION
337423
- name: Print version (please check it is not dirty)
338424
run: dist/argo-linux-amd64 version
339425
- run: make checksums

0 commit comments

Comments
 (0)