From cc0391eba52d8036cda0a14ff9d5ec87380b2f49 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Fri, 14 Feb 2025 12:04:51 +0100 Subject: [PATCH] ci: infer go version from workflow for bsd tests Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/build.yml | 4 ++++ hack/Vagrantfile.freebsd | 9 ++++++--- hack/Vagrantfile.openbsd | 6 +++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c549d900..b1f8e11d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -254,6 +254,10 @@ jobs: name: Prepare run: | echo "VAGRANT_FILE=hack/Vagrantfile.${{ matrix.os }}" >> $GITHUB_ENV + + # Sets semver Go version to be able to download tarball during vagrant setup + 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) + echo "GO_VERSION=$goVersion" >> $GITHUB_ENV - name: Checkout uses: actions/checkout@v4 diff --git a/hack/Vagrantfile.freebsd b/hack/Vagrantfile.freebsd index f86df613..8f3fa06c 100644 --- a/hack/Vagrantfile.freebsd +++ b/hack/Vagrantfile.freebsd @@ -9,10 +9,13 @@ Vagrant.configure("2") do |config| config.vm.provision "init", type: "shell", run: "once" do |sh| sh.inline = <<~SHELL + set -x pkg bootstrap - pkg install -y go123 git - ln -s /usr/local/bin/go123 /usr/local/bin/go - go install gotest.tools/gotestsum@#{ENV['GOTESTSUM_VERSION']} + pkg install -y git + + fetch https://go.dev/dl/go#{ENV['GO_VERSION']}.freebsd-amd64.tar.gz + tar -C /usr/local -xzf go#{ENV['GO_VERSION']}.freebsd-amd64.tar.gz + ln -s /usr/local/go/bin/go /usr/local/bin/go SHELL end end diff --git a/hack/Vagrantfile.openbsd b/hack/Vagrantfile.openbsd index adab6b27..12197d9a 100644 --- a/hack/Vagrantfile.openbsd +++ b/hack/Vagrantfile.openbsd @@ -10,12 +10,12 @@ Vagrant.configure("2") do |config| config.vm.provision "init", type: "shell", run: "once" do |sh| sh.inline = <<~SHELL + set -x pkg_add -x git - ftp https://go.dev/dl/go1.23.3.openbsd-amd64.tar.gz - tar -C /usr/local -xzf go1.23.3.openbsd-amd64.tar.gz + ftp https://go.dev/dl/go#{ENV['GO_VERSION']}.openbsd-amd64.tar.gz + tar -C /usr/local -xzf go#{ENV['GO_VERSION']}.openbsd-amd64.tar.gz ln -s /usr/local/go/bin/go /usr/local/bin/go - go install gotest.tools/gotestsum@#{ENV['GOTESTSUM_VERSION']} SHELL end end