Skip to content

Remove goreleaser in favor of build scripts #2143

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 39 commits into from
Jun 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
bc06a6f
chore: write build_go.sh script and dependencies
deansheather Jun 7, 2022
850bc82
chore: write build_go_matrix.sh and archive.sh
deansheather Jun 8, 2022
e847230
fixup! chore: write build_go_matrix.sh and archive.sh
deansheather Jun 8, 2022
4edb649
fixup! chore: write build_go_matrix.sh and archive.sh
deansheather Jun 8, 2022
4ed419c
merge main
deansheather Jun 8, 2022
cef0221
chore: add scripts for packages
deansheather Jun 8, 2022
64f9648
chore: add scripts for building a docker image
deansheather Jun 8, 2022
998bc31
chore: add docker multi-arch script and release script
deansheather Jun 9, 2022
46b5d79
fixup! chore: add docker multi-arch script and release script
deansheather Jun 9, 2022
9e279a9
chore: fix indenting
deansheather Jun 9, 2022
4885076
chore: update makefile to use new build scripts
deansheather Jun 9, 2022
044780d
chore: update release workflow to use new build scripts
deansheather Jun 10, 2022
59cd2c7
fixup! chore: update release workflow to use new build scripts
deansheather Jun 12, 2022
d1edee5
fixup! chore: update release workflow to use new build scripts
deansheather Jun 12, 2022
4f03e37
fixup! chore: update release workflow to use new build scripts
deansheather Jun 12, 2022
5c9dd9e
fixup! chore: update release workflow to use new build scripts
deansheather Jun 12, 2022
e09edfd
fixup! chore: update release workflow to use new build scripts
deansheather Jun 13, 2022
4dd6f4d
chore: add dependency checks to release scripts
deansheather Jun 13, 2022
72d8b50
fixup! chore: add dependency checks to release scripts
deansheather Jun 13, 2022
17cda1f
fixup! chore: add dependency checks to release scripts
deansheather Jun 13, 2022
6a4bc44
fixup! chore: add dependency checks to release scripts
deansheather Jun 13, 2022
e150438
fixup! chore: add dependency checks to release scripts
deansheather Jun 13, 2022
449a1a1
chore: make dependency checks nicer
deansheather Jun 14, 2022
ba78076
fixup! chore: make dependency checks nicer
deansheather Jun 14, 2022
a19ef36
fixup! chore: make dependency checks nicer
deansheather Jun 14, 2022
94a6fcd
fixup! chore: make dependency checks nicer
deansheather Jun 14, 2022
c524507
fixup! chore: make dependency checks nicer
deansheather Jun 14, 2022
48eaa18
fixup! chore: make dependency checks nicer
deansheather Jun 14, 2022
ce3f4f5
fixup! chore: make dependency checks nicer
deansheather Jun 14, 2022
4886542
fixup! chore: make dependency checks nicer
deansheather Jun 14, 2022
d4631ad
fixup! chore: make dependency checks nicer
deansheather Jun 14, 2022
a0c9a96
chore: integrate docker into pipeline
deansheather Jun 15, 2022
0907c37
fixup! chore: integrate docker into pipeline
deansheather Jun 15, 2022
4a94e25
fixup! chore: integrate docker into pipeline
deansheather Jun 16, 2022
37badc3
Merge branch 'main' into remove-goreleaser
deansheather Jun 16, 2022
173031f
chore: add version checks to lib.sh
deansheather Jun 16, 2022
ae48f20
fixup! chore: add version checks to lib.sh
deansheather Jun 16, 2022
d8a624c
fixup! chore: add version checks to lib.sh
deansheather Jun 16, 2022
6f2b997
Merge branch 'main' into remove-goreleaser
deansheather Jun 18, 2022
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
Prev Previous commit
Next Next commit
chore: make dependency checks nicer
  • Loading branch information
deansheather committed Jun 14, 2022
commit 449a1a1e8db7cd7fcfc41ac6f3ddb969294ad78f
18 changes: 5 additions & 13 deletions scripts/archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,14 @@ fi
input_file="$(realpath "$1")"

# Check dependencies
if [[ "$format" == "zip" ]] && ! command -v zip; then
error "The 'zip' binary is required."
if [[ "$format" == "zip" ]]; then
dependencies zip
fi
if [[ "$format" == "tar.gz" ]] && ! command -v tar; then
error "The 'tar' binary is required."
if [[ "$format" == "tar.gz" ]]; then
dependencies tar
fi
if [[ "$sign_darwin" == 1 ]]; then
if ! command -v jq; then
error "The 'jq' binary is required."
fi
if ! command -v codesign; then
error "The 'codesign' binary is required."
fi
if ! command -v gon; then
error "The 'gon' binary is required."
fi
dependencies jq codesign gon
fi

# Determine default output path.
Expand Down
4 changes: 1 addition & 3 deletions scripts/build_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ if [[ "$arch" == "" ]]; then
fi

# Check dependencies
if ! command -v docker; then
error "The 'docker' binary is required."
fi
dependencies docker

# Remove the "v" prefix.
version="${version#v}"
Expand Down
4 changes: 1 addition & 3 deletions scripts/build_docker_multiarch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ if [[ "$#" == 0 ]]; then
fi

# Check dependencies
if ! command -v docker; then
error "The 'docker' binary is required."
fi
dependencies docker

# Remove the "v" prefix.
version="${version#v}"
Expand Down
14 changes: 2 additions & 12 deletions scripts/build_go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,9 @@ if [[ "$version" == "" ]]; then
fi

# Check dependencies
if ! command -v go; then
error "The 'go' binary is required."
fi
dependencies go
if [[ "$sign_darwin" == 1 ]]; then
if ! command -v jq; then
error "The 'jq' binary is required."
fi
if ! command -v codesign; then
error "The 'codesign' binary is required."
fi
if ! command -v gon; then
error "The 'gon' binary is required."
fi
dependencies codesign
fi

build_args=(
Expand Down
30 changes: 11 additions & 19 deletions scripts/build_go_matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,34 +142,26 @@ for s in $(echo "$specs_str" | tr " " "\n" | awk '!a[$0]++'); do
done

# Check dependencies
if ! command -v go; then
error "The 'go' binary is required."
fi
dependencies go
if [[ "$sign_darwin" == 1 ]]; then
if ! command -v jq; then
error "The 'jq' binary is required."
fi
if ! command -v codesign; then
error "The 'codesign' binary is required."
fi
if ! command -v gon; then
error "The 'gon' binary is required."
fi
dependencies jq codesign gon
fi
if [[ "$archive" == 1 ]]; then
if [[ "$may_zip" == 1 ]] && ! command -v zip; then
error "The 'zip' binary is required."
if [[ "$may_zip" == 1 ]]; then
dependencies zip
fi
if [[ "$may_tar" == 1 ]] && ! command -v tar; then
error "The 'zip' binary is required."
if [[ "$may_tar" == 1 ]]; then
dependencies tar
fi
fi
if [[ "$package_linux" == 1 ]] && ! command -v nfpm; then
error "The 'nfpm' binary is required."
if [[ "$package_linux" == 1 ]]; then
dependencies nfpm
fi

bin_name="coder"
build_args=()
if [[ "$slim" == 1 ]]; then
bin_name+="-slim"
build_args+=(--slim)
fi
if [[ "$sign_darwin" == 1 ]]; then
Expand All @@ -195,7 +187,7 @@ for spec in "${specs[@]}"; do
# Ensure parent dir.
mkdir -p "$(dirname "$spec_output")"

log "--- Building coder for $spec_os $spec_arch ($spec_output_binary)"
log "--- Building $bin_name for $spec_os $spec_arch ($spec_output_binary)"
execrelative ./build_go.sh \
--version "$version" \
--os "$spec_os" \
Expand Down
4 changes: 1 addition & 3 deletions scripts/build_go_slim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ while true; do
done

# Check dependencies
if ! command -v go; then
error "The 'go' binary is required."
fi
dependencies go

# Remove the "v" prefix.
version="${version#v}"
Expand Down
20 changes: 19 additions & 1 deletion scripts/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ set -euo pipefail
#
# Taken from https://stackoverflow.com/a/3915420 (CC-BY-SA 4.0)
realpath() {
local dir
local base
dir="$(dirname "$1")"
base="$(basename "$1")"

if [[ ! -d "$dir" ]]; then
error "Could not change directory to '$dir': directory does not exist"
fi
Expand Down Expand Up @@ -57,12 +60,27 @@ cdroot() {
# be sourced by other scripts.
execrelative() {
pushd "$SCRIPT_DIR" || error "Could not change directory to '$SCRIPT_DIR'"
rc=0
local rc=0
"$@" || rc=$?
popd
return $rc
}

dependencies() {
local fail=0
for dep in "$@"; do
if ! command -v "$dep" >/dev/null; then
log "ERROR: The '$dep' dependency is required, but is not available."
fail=1
fi
done

if [[ "$fail" == 1 ]]; then
log
error "One or more dependencies are not available, check above log output for more details."
fi
}

# maybedryrun prints the given program and flags, and then, if the first
# argument is 0, executes it. The reason the first argument should be 0 is that
# it is expected that you have a dry_run variable in your script that is set to
Expand Down
4 changes: 1 addition & 3 deletions scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ fi
input_file="$(realpath "$1")"

# Check dependencies
if ! command -v nfpm; then
error "The 'nfpm' binary is required."
fi
dependencies nfpm

# Remove the "v" prefix.
version="${version#v}"
Expand Down
4 changes: 1 addition & 3 deletions scripts/publish_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ while true; do
done

# Check dependencies
if ! command -v gh; then
error "The 'gh' binary is required."
fi
dependencies gh

# Remove the "v" prefix.
version="${version#v}"
Expand Down
16 changes: 5 additions & 11 deletions scripts/sign_darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,13 @@ if [[ "${AC_APPLICATION_IDENTITY:-}" == "" ]]; then
fi

# Check dependencies
if ! command -v jq; then
error "The 'jq' binary is required."
fi
if ! command -v codesign; then
error "The 'codesign' binary is required."
fi
if ! command -v gon; then
error "The 'gon' binary is required."
fi
dependencies jq codesign gon

output_path="$1"

# Create the gon config.
config="$(mktemp -d)/gon.json"
jq -r --null-input --arg path "$(pwd)/$1" '{
jq -r --null-input --arg path "$output_path" '{
"notarize": [
{
"path": $path,
Expand All @@ -43,7 +37,7 @@ jq -r --null-input --arg path "$(pwd)/$1" '{
}' >"$config"

# Sign the zip file with our certificate.
codesign -s "$AC_APPLICATION_IDENTITY" -f -v --timestamp --options runtime "$1"
codesign -s "$AC_APPLICATION_IDENTITY" -f -v --timestamp --options runtime "$output_path"

# Notarize the signed zip file.
#
Expand Down
2 changes: 1 addition & 1 deletion scripts/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if [[ "$last_tag" != "$current" ]]; then
# make won't exit on $(shell cmd) failures :(
if [[ "$(ps -o comm= "$PPID" || true)" == *make* ]]; then
log "ERROR: version.sh attemped to generate a dev version string when CODER_NO_DEV_VERSION was set"
kill "$PPID"
kill "$PPID" || true
exit 1
fi

Expand Down