chore: parallel makefile attempt 3 (#3926)

* Revert "chore: Revert parallel Makefile builds (#3918)"

This reverts commit b077f71015.

* fix: fix release workflow with parallel makefile

* fix: mark generated files as fresh during releases
This commit is contained in:
Dean Sheather
2022-09-08 02:40:17 +10:00
committed by GitHub
parent 3d6d51fbd0
commit 819622182b
19 changed files with 589 additions and 753 deletions

View File

@ -12,7 +12,7 @@
# with "vX" (e.g. "v7", "v8").
#
# Unless overridden via --output, the built binary will be dropped in
# "$repo_root/dist/coder_$version_$os_$arch" (with a ".exe" suffix for windows
# "$repo_root/build/coder_$version_$os_$arch" (with a ".exe" suffix for windows
# builds) and the absolute path to the binary will be printed to stdout on
# completion.
#
@ -26,13 +26,12 @@
set -euo pipefail
# shellcheck source=scripts/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
cdroot
version=""
os="${GOOS:-linux}"
arch="${GOARCH:-amd64}"
slim="${CODER_SLIM_BUILD:-0}"
sign_darwin=0
sign_darwin="${CODER_SIGN_DARWIN:-0}"
output_path=""
agpl="${CODER_BUILD_AGPL:-0}"
@ -53,6 +52,7 @@ while true; do
shift 2
;;
--output)
mkdir -p "$(dirname "$2")"
output_path="$(realpath "$2")"
shift 2
;;
@ -81,6 +81,8 @@ while true; do
esac
done
cdroot
# Remove the "v" prefix.
version="${version#v}"
if [[ "$version" == "" ]]; then
@ -102,9 +104,8 @@ fi
# Compute default output path.
if [[ "$output_path" == "" ]]; then
dist_dir="dist"
mkdir -p "$dist_dir"
output_path="${dist_dir}/coder_${version}_${os}_${arch}"
mkdir -p "build"
output_path="build/coder_${version}_${os}_${arch}"
if [[ "$os" == "windows" ]]; then
output_path+=".exe"
fi
@ -132,7 +133,13 @@ CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" GOARM="$arm_version" go build \
"$cmd_path" 1>&2
if [[ "$sign_darwin" == 1 ]] && [[ "$os" == "darwin" ]]; then
codesign -s "$AC_APPLICATION_IDENTITY" -f -v --timestamp --options runtime "$output_path"
codesign \
-f -v \
-s "$AC_APPLICATION_IDENTITY" \
--timestamp \
--options runtime \
"$output_path" \
1>&2
fi
echo "$output_path"