Skip to content

Commit f1ddb4e

Browse files
committed
ci: install known go version
Instead of relying a distro to provide a recent Go version, let's install it ourselves from a binary distribution. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 67cd4ed commit f1ddb4e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

.github/workflows/containers.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
baseimage: ['debian:bullseye', 'ubuntu:20.04', 'ubuntu:22.04']
21+
go: [1.23, 1.24]
2122
steps:
2223
- uses: actions/checkout@v4
2324
- name: Run tests in container
24-
run: ./scripts/ci-runner.sh run_in_ct ${{ matrix.baseimage }}
25+
run: ./scripts/ci-runner.sh run_in_ct ${{ matrix.baseimage }} ${{ matrix.go }}
2526

2627
all-done:
2728
needs:

scripts/ci-runner.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,31 @@ function build_tests {
2525

2626
function run_in_ct {
2727
local image=$1
28+
local gover=$2
2829
local name="go-systemd/container-tests"
2930
local cidfile=/tmp/cidfile.$$
3031
local cid
3132

33+
# Figure out Go URL, based on $gover.
34+
local prefix="https://go.dev/dl/" filename
35+
filename=$(curl -fsSL "${prefix}?mode=json&include=all" |
36+
jq -r --arg Ver "go$gover" '. | map(select(.version | contains($Ver))) | first | .files[] | select(.os == "linux" and .arch == "amd64" and .kind == "archive") | .filename')
37+
gourl="${prefix}${filename}"
38+
3239
set -x
3340
docker pull "$image"
3441
docker run -i --privileged --cidfile="$cidfile" "$image" /bin/bash -e -x << EOF
3542
export DEBIAN_FRONTEND=noninteractive
3643
apt-get -qq update
3744
apt-get -qq install -y -o Dpkg::Use-Pty=0 \
38-
sudo build-essential git golang dbus libsystemd-dev libpam-systemd systemd-container
45+
sudo build-essential curl git dbus libsystemd-dev libpam-systemd systemd-container
3946
# Fixup git.
4047
git config --global --add safe.directory /src
48+
# Install Go.
49+
curl -fsSL "$gourl" | tar Cxz /usr/local
50+
ln -s /usr/local/go/bin/go /usr/local/bin/go
51+
go version
52+
go env
4153
EOF
4254
cid=$(cat "$cidfile")
4355
rm -f "$cidfile"

0 commit comments

Comments
 (0)