...
1---
2name: Containers
3
4on:
5 push:
6 branches: [main]
7 pull_request:
8 branches: [main]
9
10permissions:
11 contents: read
12
13env:
14 GO_TOOLCHAIN: "1.15"
15 GOPATH: "/opt"
16 BUILD_DIR: "/opt/src/github.com/coreos/go-systemd"
17
18jobs:
19 ditro-test:
20 name: "Distro test"
21 runs-on: ubuntu-latest
22 strategy:
23 matrix:
24 baseimage: ['debian:stretch', 'ubuntu:18.04', 'ubuntu:20.04']
25 steps:
26 - run: sudo apt-get -qq update
27 - name: Install libsystemd-dev
28 run: sudo apt-get install libsystemd-dev
29 - uses: actions/checkout@v2
30 - name: Setup go
31 uses: actions/setup-go@v1
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
38 - name: Pull base image - ${{ matrix.baseimage }}
39 run: docker pull ${{ matrix.baseimage }}
40 - 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"
42 - name: Persist base container
43 run: docker commit `cat /tmp/cidfile` go-systemd/container-tests
44 - run: rm -f /tmp/cidfile
45 - 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
47 - name: Wait a bit for the whole system to settle
48 run: sleep 30s
49 - name: Run tests
50 run: docker exec --privileged `cat /tmp/cidfile` /bin/bash -c "cd ${BUILD_DIR} && ./scripts/ci-runner.sh run_tests"
51 - name: Cleanup
52 run: docker kill `cat /tmp/cidfile`
View as plain text