Skip to content

Commit cc0391e

Browse files
committed
ci: infer go version from workflow for bsd tests
Signed-off-by: CrazyMax <[email protected]>
1 parent 80c16bc commit cc0391e

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

.github/workflows/build.yml

+4
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,10 @@ jobs:
254254
name: Prepare
255255
run: |
256256
echo "VAGRANT_FILE=hack/Vagrantfile.${{ matrix.os }}" >> $GITHUB_ENV
257+
258+
# Sets semver Go version to be able to download tarball during vagrant setup
259+
goVersion=$(curl --silent "https://go.dev/dl/?mode=json&include=all" | jq -r '.[].files[].version' | uniq | sed -e 's/go//' | sort -V | grep $GO_VERSION | tail -1)
260+
echo "GO_VERSION=$goVersion" >> $GITHUB_ENV
257261
-
258262
name: Checkout
259263
uses: actions/checkout@v4

hack/Vagrantfile.freebsd

+6-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ Vagrant.configure("2") do |config|
99

1010
config.vm.provision "init", type: "shell", run: "once" do |sh|
1111
sh.inline = <<~SHELL
12+
set -x
1213
pkg bootstrap
13-
pkg install -y go123 git
14-
ln -s /usr/local/bin/go123 /usr/local/bin/go
15-
go install gotest.tools/gotestsum@#{ENV['GOTESTSUM_VERSION']}
14+
pkg install -y git
15+
16+
fetch https://go.dev/dl/go#{ENV['GO_VERSION']}.freebsd-amd64.tar.gz
17+
tar -C /usr/local -xzf go#{ENV['GO_VERSION']}.freebsd-amd64.tar.gz
18+
ln -s /usr/local/go/bin/go /usr/local/bin/go
1619
SHELL
1720
end
1821
end

hack/Vagrantfile.openbsd

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ Vagrant.configure("2") do |config|
1010

1111
config.vm.provision "init", type: "shell", run: "once" do |sh|
1212
sh.inline = <<~SHELL
13+
set -x
1314
pkg_add -x git
1415
15-
ftp https://go.dev/dl/go1.23.3.openbsd-amd64.tar.gz
16-
tar -C /usr/local -xzf go1.23.3.openbsd-amd64.tar.gz
16+
ftp https://go.dev/dl/go#{ENV['GO_VERSION']}.openbsd-amd64.tar.gz
17+
tar -C /usr/local -xzf go#{ENV['GO_VERSION']}.openbsd-amd64.tar.gz
1718
ln -s /usr/local/go/bin/go /usr/local/bin/go
18-
go install gotest.tools/gotestsum@#{ENV['GOTESTSUM_VERSION']}
1919
SHELL
2020
end
2121
end

0 commit comments

Comments
 (0)