Skip to content

Makefile buff-ification #3700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 8 additions & 25 deletions .github/workflows/coder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -496,35 +496,21 @@ jobs:
- name: Install zstd
run: sudo apt-get install -y zstd

- name: Build site
run: make -B site/out/index.html

- name: Build Release
run: |
set -euo pipefail
go mod download

mkdir -p ./dist
# build slim binaries
./scripts/build_go_slim.sh \
--output ./dist/ \
--compress 22 \
linux:amd64,armv7,arm64 \
windows:amd64,arm64 \
darwin:amd64,arm64

# build linux amd64 packages
./scripts/build_go_matrix.sh \
--output ./dist/ \
--package-linux \
linux:amd64 \
windows:amd64
version="$(./script/version.sh)"
make -j \
build/coder_"$version"_windows_amd64.zip \
build/coder_"$version"_linux_amd64.{tar.gz,deb}

- name: Install Release
run: |
gcloud config set project coder-dogfood
gcloud config set compute/zone us-central1-a
gcloud compute scp ./dist/coder_*_linux_amd64.deb coder:/tmp/coder.deb
gcloud compute scp ./build/coder_*_linux_amd64.deb coder:/tmp/coder.deb
gcloud compute ssh coder -- sudo dpkg -i --force-confdef /tmp/coder.deb
gcloud compute ssh coder -- sudo systemctl daemon-reload

Expand All @@ -535,12 +521,9 @@ jobs:
with:
name: coder
path: |
./dist/*.zip
./dist/*.exe
./dist/*.tar.gz
./dist/*.apk
./dist/*.deb
./dist/*.rpm
./build/*.zip
./build/*.tar.gz
./build/*.deb
retention-days: 7

test-js:
Expand Down
83 changes: 28 additions & 55 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,46 +71,28 @@ jobs:
- name: Install zstd
run: sudo apt-get install -y zstd

- name: Build Site
run: make site/out/index.html

- name: Build Linux and Windows Binaries
run: |
set -euo pipefail
go mod download

mkdir -p ./dist
# build slim binaries
./scripts/build_go_slim.sh \
--output ./dist/ \
--compress 22 \
linux:amd64,armv7,arm64 \
windows:amd64,arm64 \
darwin:amd64,arm64

# build linux and windows binaries
./scripts/build_go_matrix.sh \
--output ./dist/ \
--archive \
--package-linux \
linux:amd64,armv7,arm64 \
windows:amd64,arm64
version="$(./script/version.sh)"
make -j \
build/coder_"$version"_linux_{amd64,armv7,arm64}.{tar.gz,apk,deb,rpm} \
build/coder_"$version"_windows_{amd64,arm64}.zip \

- name: Build Linux Docker images
run: |
set -euxo pipefail

# build and (maybe) push Docker images for each architecture
images=()
for arch in amd64 armv7 arm64; do
img="$(
./scripts/build_docker.sh \
${{ (!github.event.inputs.dry_run && !github.event.inputs.snapshot) && '--push' || '' }} \
--arch "$arch" \
./dist/coder_*_linux_"$arch"
)"
images+=("$img")
done
version="$(./script/version.sh)"
push=""
if [[ "$CODER_RELEASE" == *t* ]]; then
push="push/"
fi
make -j \
"$push"build/coder_"$version"_linux_{amd64,arm64,armv7}.tag

# we can't build multi-arch if the images aren't pushed, so quit now
# if dry-running
Expand All @@ -120,14 +102,13 @@ jobs:
fi

# build and push multi-arch manifest
./scripts/build_docker_multiarch.sh \
--push \
"${images[@]}"
make -j push/build/coder_"$version"_linux.tag

# if the current version is equal to the highest (according to semver)
# version in the repo, also create a multi-arch image as ":latest" and
# push it
if [[ "$(git tag | grep '^v' | grep -vE '(rc|dev|-|\+|\/)' | sort -r --version-sort | head -n1)" == "v$(./scripts/version.sh)" ]]; then
make -j push/build/coder_"$version"_linux.tag
./scripts/build_docker_multiarch.sh \
--push \
--target "$(./scripts/image_tag.sh --version latest)" \
Expand All @@ -139,11 +120,11 @@ jobs:
with:
name: linux
path: |
dist/*.zip
dist/*.tar.gz
dist/*.apk
dist/*.deb
dist/*.rpm
./build/*.zip
./build/*.tar.gz
./build/*.apk
./build/*.deb
./build/*.rpm

# The mac binaries get built on mac runners because they need to be signed,
# and the signing tool only runs on mac. This darwin job only builds the Mac
Expand Down Expand Up @@ -213,22 +194,11 @@ jobs:
set -euo pipefail
go mod download

mkdir -p ./dist
# build slim binaries
./scripts/build_go_slim.sh \
--output ./dist/ \
--compress 22 \
linux:amd64,armv7,arm64 \
windows:amd64,arm64 \
darwin:amd64,arm64

# build darwin binaries
./scripts/build_go_matrix.sh \
--output ./dist/ \
--archive \
--sign-darwin \
darwin:amd64,arm64
version="$(./script/version.sh)"
make -j \
build/coder_"$version"_darwin_{amd64,arm64}.zip
env:
CODER_SIGN_DARWIN: "1"
AC_USERNAME: ${{ secrets.AC_USERNAME }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
AC_APPLICATION_IDENTITY: BDB050EB749EDD6A80C6F119BF1382ECA119CCCC
Expand All @@ -237,7 +207,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: darwin
path: ./dist/coder_*.zip
path: ./build/*.zip

publish:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -278,8 +248,11 @@ jobs:
- name: Publish Helm
run: |
set -euxo pipefail
./scripts/helm.sh --push
mv ./dist/*.tgz ./artifacts/

version="$(./script/version.sh)"
make -j \
build/coder_helm_"$version".tgz
mv ./build/*.tgz ./artifacts/

- name: Publish Release
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ site/**/*.typegen.ts
site/build-storybook.log

# Build
build/
dist/
site/out/

Expand Down
Loading