Modernize and fix CI #219
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Containers | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
permissions: | |
contents: read | |
env: | |
GO_VERSION_PREFIX: 1.24 | |
jobs: | |
distro-test: | |
name: "Distro test" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
baseimage: ['debian:bullseye', 'ubuntu:20.04', 'ubuntu:22.04'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Find Go download URL | |
run: | | |
URL_PREFIX="https://go.dev/dl/" | |
# Find out the latest minor release URL. | |
filename=$(curl -fsSL "${URL_PREFIX}?mode=json&include=all" | jq -r --arg Ver "go$GO_VERSION_PREFIX" '. | map(select(.version | contains($Ver))) | first | .files[] | select(.os == "linux" and .arch == "amd64" and .kind == "archive") | .filename') | |
echo "GO_URL=$URL_PREFIX$filename" >> $GITHUB_ENV | |
- name: Pull base image - ${{ matrix.baseimage }} | |
run: docker pull ${{ matrix.baseimage }} | |
- name: Install packages for ${{ matrix.baseimage }} | |
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 curl git dbus libsystemd-dev libpam-systemd systemd-container; curl -fsSL "$GO_URL" | tar Cxz /usr/local; ln -s /usr/local/go/bin/go /usr/local/bin/go" | |
- name: Persist base container | |
run: | | |
docker commit `cat /tmp/cidfile` go-systemd/container-tests | |
docker rm -f `cat /tmp/cidfile` | |
rm -f /tmp/cidfile | |
- name: Run systemd from ${{ matrix.baseimage }} | |
run: docker run --shm-size=2gb --pids-limit=-1 --memory=0 -d --cidfile=/tmp/cidfile --privileged -v ${PWD}:/src go-systemd/container-tests /bin/systemd --system | |
- name: Fixup git | |
run: docker exec --privileged `cat /tmp/cidfile` /bin/bash -e -c 'git config --global --add safe.directory /src' | |
- name: Build tests | |
run: docker exec --privileged `cat /tmp/cidfile` /bin/bash -e -c 'go version; cd /src; ./scripts/ci-runner.sh build_tests' | |
- name: Wait a bit for the whole system to settle | |
run: sleep 30s | |
- name: "[debug] show limits" | |
run: docker exec --privileged `cat /tmp/cidfile` /bin/bash -x -c 'ulimit -a; tail /sys/fs/cgroup/*.max; tail /sys/fs/kernel/*max; true' | |
- name: Run tests | |
run: docker exec --privileged `cat /tmp/cidfile` /bin/bash -e -c 'cd /src; ./scripts/ci-runner.sh run_tests' | |
- name: Cleanup | |
run: docker kill `cat /tmp/cidfile` | |
all-done: | |
needs: | |
- distro-test | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "All jobs completed" |