Skip to content

Commit

Permalink
Steps to get nightlies compiling again
Browse files Browse the repository at this point in the history
 * Move schedule to be within working hours, so we get alerts on failure
 * Update GH Actions and the Go version
 * Update goreleaser version to v2
   + nsc uses goreleaser.yaml version 2
   + nats-io/natscli#1191 gets natscli to the same version
 * Support a parallelism pass-through for `goreleaser`, to avoid making my
   laptop beg for mercy while testing
  • Loading branch information
philpennock committed Dec 9, 2024
1 parent de118ea commit adcffca
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:
required: true
type: string
schedule:
- cron: "33 4 * * *"
# 2022-08-08: want this to run again soon, so moved from "33 2" to "33 4", can be reverted any time after this
# Keep this during US working hours
- cron: "33 10 * * *"

permissions:
# Control the GITHUB_TOKEN permissions.
Expand All @@ -34,11 +34,12 @@ jobs:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
# v5 over v4 updates the Node runtime from node16 to node20.
with:
# This should be quoted or use .x, but should not be unquoted.
# Remember that a YAML bare float drops trailing zeroes.
go-version: '1.22'
go-version: '1.23'
check-latest: true
# As of v3 of this action, we could also use `go-version-file: # go.mod`
# and get the version from there, but that is semantically wrong: the
Expand All @@ -50,11 +51,7 @@ jobs:
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
# 2024-06-05: goreleaser v2 is out, and makes deprecations fatal.
# Our build-nightlies.sh invokes goreleaser in the repos for the nsc
# and natscli tools, so we can't update until both of those are
# deprecation-free under v1.26.2
version: "~> v1"
version: "~> v2"
install-only: true

- name: Install cosign
Expand Down
16 changes: 14 additions & 2 deletions build-nightlies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Usage: $progname [-d <date>] [-rP]
-r reuse existing build
-P don't publish (don't need API keys)
-S don't sign (don't need private signing keys)
-p N parallelism to pass to goreleaser
The DATE should be in YYYYMMDD format or, for extra runs on a given day,
in YYYYMMDD_NNN format.
Expand All @@ -78,10 +79,16 @@ parse_options() {
local arg OPTIND
opt_publish=1
opt_sign=1
while getopts ':d:hrPS' arg; do
opt_parallelism=''
while getopts ':d:hp:rPS' arg; do
case "$arg" in
h) usage 0 ;;
d) NIGHTLY_DATE="$OPTARG" ;;
p)
[[ "$OPTARG" =~ ^[0-9]+$ ]] || die_n "$EX_USAGE" "need -p to be a number";
(( "$OPTARG" > 0 )) || die_n "$EX_USAGE" "need -p to be a positive number";
opt_parallelism="$OPTARG"
;;
r) USE_EXISTING_BUILD=1 ;;
P) opt_publish=0 ;;
S) opt_sign=0 ;;
Expand Down Expand Up @@ -161,6 +168,7 @@ build_one_tool() {
local tool="$1"
shift
local clone_dir dist_dir
local -a build_flags
clone_dir="$(dir_for_tool "$tool")"
cd "$clone_dir"
if [[ -n "${SKIP_BUILD:-}" ]]; then
Expand All @@ -173,7 +181,11 @@ build_one_tool() {
return
fi

goreleaser build --snapshot --clean
build_flags=(--snapshot --clean)
if [[ -n "${opt_parallelism:-}" ]]; then
build_flags+=(--parallelism "$opt_parallelism")
fi
goreleaser build "${build_flags[@]}"
}

check_have_publish_credentials() {
Expand Down

0 comments on commit adcffca

Please sign in to comment.