Skip to content

Commit 743c5ad

Browse files
committed
ci: fix running tests in containers
Ubuntu-20.04 is no longer supported by GHA CI, and when switching to ubuntu-latest (which is 24.04 at the moment), tests built on the host no longer work inside a container, because they require newer glibc: Running tests... /opt/src/github.com/coreos/go-systemd/test_bins /opt/src/github.com/coreos/go-systemd - activation ./activation.test: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./activation.test) ./activation.test: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./activation.test) So, let's switch to building tests inside the container as well. Note: - the default Go version that comes with a distro is used for building; - there is no need to build sources. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 55245d4 commit 743c5ad

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

.github/workflows/containers.yml

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,34 @@ on:
1010
permissions:
1111
contents: read
1212

13-
env:
14-
GO_TOOLCHAIN: "1.24"
15-
GOPATH: "/opt"
16-
BUILD_DIR: "/opt/src/github.com/coreos/go-systemd"
17-
1813
jobs:
1914
distro-test:
2015
name: "Distro test"
2116
runs-on: ubuntu-latest
2217
strategy:
18+
fail-fast: false
2319
matrix:
2420
baseimage: ['debian:bullseye', 'ubuntu:20.04', 'ubuntu:22.04']
2521
steps:
26-
- run: sudo apt-get -qq update
27-
- name: Install libsystemd-dev
28-
run: sudo apt-get install libsystemd-dev
2922
- uses: actions/checkout@v4
30-
- name: Setup go
31-
uses: actions/setup-go@v5
32-
with:
33-
go-version: ${{ env['GO_TOOLCHAIN'] }}
34-
- name: Go build (source)
35-
run: ./scripts/ci-runner.sh build_source
36-
- name: Go build (tests)
37-
run: ./scripts/ci-runner.sh build_tests
3823
- name: Pull base image - ${{ matrix.baseimage }}
3924
run: docker pull ${{ matrix.baseimage }}
4025
- name: Install packages for ${{ matrix.baseimage }}
41-
run: docker run --privileged -e GOPATH=${GOPATH} --cidfile=/tmp/cidfile ${{ matrix.baseimage }} /bin/bash -c "export DEBIAN_FRONTEND=noninteractive; apt-get update && apt-get install -y sudo build-essential git golang dbus libsystemd-dev libpam-systemd systemd-container"
26+
run: docker run --privileged --cidfile=/tmp/cidfile ${{ matrix.baseimage }} /bin/bash -e -c "export DEBIAN_FRONTEND=noninteractive; apt-get update; apt-get install -y sudo build-essential git golang dbus libsystemd-dev libpam-systemd systemd-container"
4227
- name: Persist base container
43-
run: docker commit `cat /tmp/cidfile` go-systemd/container-tests
44-
- run: rm -f /tmp/cidfile
28+
run: |
29+
docker commit `cat /tmp/cidfile` go-systemd/container-tests
30+
docker rm -f `cat /tmp/cidfile`
31+
rm -f /tmp/cidfile
4532
- name: Run systemd from ${{ matrix.baseimage }}
46-
run: docker run --shm-size=2gb -d --cidfile=/tmp/cidfile --privileged -e GOPATH=${GOPATH} -v ${PWD}:${BUILD_DIR} go-systemd/container-tests /bin/systemd --system
33+
run: docker run --shm-size=2gb -d --cidfile=/tmp/cidfile --privileged -v ${PWD}:/src go-systemd/container-tests /bin/systemd --system
34+
- name: Fixup git
35+
run: docker exec --privileged `cat /tmp/cidfile` /bin/bash -e -c 'git config --global --add safe.directory /src'
36+
- name: Build tests
37+
run: docker exec --privileged `cat /tmp/cidfile` /bin/bash -e -c 'cd /src; ./scripts/ci-runner.sh build_tests'
4738
- name: Wait a bit for the whole system to settle
4839
run: sleep 30s
4940
- name: Run tests
50-
run: docker exec --privileged `cat /tmp/cidfile` /bin/bash -c "cd ${BUILD_DIR} && ./scripts/ci-runner.sh run_tests"
41+
run: docker exec --privileged `cat /tmp/cidfile` /bin/bash -e -c 'cd /src; ./scripts/ci-runner.sh run_tests'
5142
- name: Cleanup
5243
run: docker kill `cat /tmp/cidfile`

0 commit comments

Comments
 (0)