Skip to content

Commit 8196221

Browse files
authored
chore: parallel makefile attempt 3 (#3926)
* Revert "chore: Revert parallel Makefile builds (#3918)" This reverts commit b077f71. * fix: fix release workflow with parallel makefile * fix: mark generated files as fresh during releases
1 parent 3d6d51f commit 8196221

19 files changed

+591
-755
lines changed

.github/workflows/coder.yaml

+8-25
Original file line numberDiff line numberDiff line change
@@ -500,35 +500,21 @@ jobs:
500500
- name: Install zstd
501501
run: sudo apt-get install -y zstd
502502

503-
- name: Build site
504-
run: make -B site/out/index.html
505-
506503
- name: Build Release
507504
run: |
508505
set -euo pipefail
509506
go mod download
510507
511-
mkdir -p ./dist
512-
# build slim binaries
513-
./scripts/build_go_slim.sh \
514-
--output ./dist/ \
515-
--compress 22 \
516-
linux:amd64,armv7,arm64 \
517-
windows:amd64,arm64 \
518-
darwin:amd64,arm64
519-
520-
# build linux amd64 packages
521-
./scripts/build_go_matrix.sh \
522-
--output ./dist/ \
523-
--package-linux \
524-
linux:amd64 \
525-
windows:amd64
508+
version="$(./scripts/version.sh)"
509+
make -j \
510+
build/coder_"$version"_windows_amd64.zip \
511+
build/coder_"$version"_linux_amd64.{tar.gz,deb}
526512
527513
- name: Install Release
528514
run: |
529515
gcloud config set project coder-dogfood
530516
gcloud config set compute/zone us-central1-a
531-
gcloud compute scp ./dist/coder_*_linux_amd64.deb coder:/tmp/coder.deb
517+
gcloud compute scp ./build/coder_*_linux_amd64.deb coder:/tmp/coder.deb
532518
gcloud compute ssh coder -- sudo dpkg -i --force-confdef /tmp/coder.deb
533519
gcloud compute ssh coder -- sudo systemctl daemon-reload
534520
@@ -539,12 +525,9 @@ jobs:
539525
with:
540526
name: coder
541527
path: |
542-
./dist/*.zip
543-
./dist/*.exe
544-
./dist/*.tar.gz
545-
./dist/*.apk
546-
./dist/*.deb
547-
./dist/*.rpm
528+
./build/*.zip
529+
./build/*.tar.gz
530+
./build/*.deb
548531
retention-days: 7
549532

550533
test-js:

.github/workflows/release.yaml

+30-63
Original file line numberDiff line numberDiff line change
@@ -73,50 +73,28 @@ jobs:
7373
7474
- name: Install nfpm
7575
run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.16.0
76-
7776
- name: Install zstd
7877
run: sudo apt-get install -y zstd
7978

80-
- name: Build Site
81-
run: make site/out/index.html
82-
8379
- name: Build Linux and Windows Binaries
8480
run: |
8581
set -euo pipefail
8682
go mod download
8783
88-
mkdir -p ./dist
89-
# build slim binaries
90-
./scripts/build_go_slim.sh \
91-
--output ./dist/ \
92-
--compress 22 \
93-
linux:amd64,armv7,arm64 \
94-
windows:amd64,arm64 \
95-
darwin:amd64,arm64
96-
97-
# build linux and windows binaries
98-
./scripts/build_go_matrix.sh \
99-
--output ./dist/ \
100-
--archive \
101-
--package-linux \
102-
linux:amd64,armv7,arm64 \
103-
windows:amd64,arm64
84+
version="$(./scripts/version.sh)"
85+
make gen/mark-fresh
86+
make -j \
87+
-W coderd/database/querier.go \
88+
build/coder_"$version"_linux_{amd64,arm64,armv7}.{tar.gz,apk,deb,rpm} \
89+
build/coder_"$version"_windows_{amd64,arm64}.zip \
10490
10591
- name: Build Linux Docker images
10692
run: |
10793
set -euxo pipefail
10894
109-
# build and (maybe) push Docker images for each architecture
110-
images=()
111-
for arch in amd64 armv7 arm64; do
112-
img="$(
113-
./scripts/build_docker.sh \
114-
${{ (!github.event.inputs.dry_run && !github.event.inputs.snapshot) && '--push' || '' }} \
115-
--arch "$arch" \
116-
./dist/coder_*_linux_"$arch"
117-
)"
118-
images+=("$img")
119-
done
95+
# build Docker images for each architecture
96+
version="$(./scripts/version.sh)"
97+
make -j build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
12098
12199
# we can't build multi-arch if the images aren't pushed, so quit now
122100
# if dry-running
@@ -125,31 +103,30 @@ jobs:
125103
exit 0
126104
fi
127105
128-
# build and push multi-arch manifest
129-
./scripts/build_docker_multiarch.sh \
130-
--push \
131-
"${images[@]}"
106+
# build and push multi-arch manifest, this depends on the other images
107+
# being pushed so will automatically push them.
108+
make -j push/build/coder_"$version"_linux.tag
132109
133110
# if the current version is equal to the highest (according to semver)
134111
# version in the repo, also create a multi-arch image as ":latest" and
135112
# push it
136113
if [[ "$(git tag | grep '^v' | grep -vE '(rc|dev|-|\+|\/)' | sort -r --version-sort | head -n1)" == "v$(./scripts/version.sh)" ]]; then
137114
./scripts/build_docker_multiarch.sh \
138-
--push \
139115
--target "$(./scripts/image_tag.sh --version latest)" \
140-
"${images[@]}"
116+
--push \
117+
$(cat build/coder_"$version"_linux_{amd64,arm64,armv7}.tag)
141118
fi
142119
143120
- name: Upload binary artifacts
144121
uses: actions/upload-artifact@v3
145122
with:
146123
name: linux
147124
path: |
148-
dist/*.zip
149-
dist/*.tar.gz
150-
dist/*.apk
151-
dist/*.deb
152-
dist/*.rpm
125+
./build/*.zip
126+
./build/*.tar.gz
127+
./build/*.apk
128+
./build/*.deb
129+
./build/*.rpm
153130
154131
# The mac binaries get built on mac runners because they need to be signed,
155132
# and the signing tool only runs on mac. This darwin job only builds the Mac
@@ -211,30 +188,17 @@ jobs:
211188
# Used for compressing embedded slim binaries
212189
brew install zstd
213190
214-
- name: Build Site
215-
run: make site/out/index.html
216-
217191
- name: Build darwin Binaries (with signatures)
218192
run: |
219193
set -euo pipefail
220194
go mod download
221195
222-
mkdir -p ./dist
223-
# build slim binaries
224-
./scripts/build_go_slim.sh \
225-
--output ./dist/ \
226-
--compress 22 \
227-
linux:amd64,armv7,arm64 \
228-
windows:amd64,arm64 \
229-
darwin:amd64,arm64
230-
231-
# build darwin binaries
232-
./scripts/build_go_matrix.sh \
233-
--output ./dist/ \
234-
--archive \
235-
--sign-darwin \
236-
darwin:amd64,arm64
196+
version="$(./scripts/version.sh)"
197+
make gen/mark-fresh
198+
make -j \
199+
build/coder_"$version"_darwin_{amd64,arm64}.zip
237200
env:
201+
CODER_SIGN_DARWIN: "1"
238202
AC_USERNAME: ${{ secrets.AC_USERNAME }}
239203
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
240204
AC_APPLICATION_IDENTITY: BDB050EB749EDD6A80C6F119BF1382ECA119CCCC
@@ -243,7 +207,7 @@ jobs:
243207
uses: actions/upload-artifact@v3
244208
with:
245209
name: darwin
246-
path: ./dist/coder_*.zip
210+
path: ./build/*.zip
247211

248212
publish:
249213
runs-on: ubuntu-latest
@@ -284,8 +248,11 @@ jobs:
284248
- name: Publish Helm
285249
run: |
286250
set -euxo pipefail
287-
./scripts/helm.sh --push
288-
mv ./dist/*.tgz ./artifacts/
251+
252+
version="$(./scripts/version.sh)"
253+
make -j \
254+
build/coder_helm_"$version".tgz
255+
mv ./build/*.tgz ./artifacts/
289256
290257
- name: Publish Release
291258
run: |

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ site/**/*.typegen.ts
3030
site/build-storybook.log
3131

3232
# Build
33+
build/
3334
dist/
3435
site/out/
3536

0 commit comments

Comments
 (0)