Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 22 additions & 24 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,41 @@ on:
permissions:
contents: read

env:
GO_TOOLCHAIN: "1.15"
GOPATH: "/opt"
BUILD_DIR: "/opt/src/github.com/coreos/go-systemd"

jobs:
ditro-test:
distro-test:
name: "Distro test"
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
baseimage: ['debian:bullseye', 'ubuntu:20.04', 'ubuntu:22.04']
steps:
- run: sudo apt-get -qq update
- name: Install libsystemd-dev
run: sudo apt-get install libsystemd-dev
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: ${{ env['GO_TOOLCHAIN'] }}
- name: Go build (source)
run: ./scripts/ci-runner.sh build_source
- name: Go build (tests)
run: ./scripts/ci-runner.sh build_tests
- uses: actions/checkout@v4
- name: Pull base image - ${{ matrix.baseimage }}
run: docker pull ${{ matrix.baseimage }}
- name: Install packages for ${{ matrix.baseimage }}
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"
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"
- name: Persist base container
run: docker commit `cat /tmp/cidfile` go-systemd/container-tests
- run: rm -f /tmp/cidfile
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 -d --cidfile=/tmp/cidfile --privileged -e GOPATH=${GOPATH} -v ${PWD}:${BUILD_DIR} go-systemd/container-tests /bin/systemd --system
run: docker run --shm-size=2gb -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 'cd /src; ./scripts/ci-runner.sh build_tests'
- name: Wait a bit for the whole system to settle
run: sleep 30s
- name: Run tests
run: docker exec --privileged `cat /tmp/cidfile` /bin/bash -c "cd ${BUILD_DIR} && ./scripts/ci-runner.sh 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"
33 changes: 8 additions & 25 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,20 @@ on:
permissions:
contents: read

env:
# Minimum supported Go toolchain
ACTION_MINIMUM_TOOLCHAIN: "1.12.x"

jobs:
build:
name: "Build"
runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.17.x', '1.18.x', '1.19.x', '1.20.x']
go: ['1.12.x', '1.23.x', '1.24.x']
steps:
- run: sudo apt-get -qq update
- name: Install libsystemd-dev
run: sudo apt-get install libsystemd-dev
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Go fmt
Expand All @@ -36,23 +32,10 @@ jobs:
run: ./scripts/ci-runner.sh build_tests
- name: Go vet
run: ./scripts/ci-runner.sh go_vet
build-minimum:
name: "Build on minimum supported toolchain"

all-done:
needs:
- build
runs-on: ubuntu-latest
steps:
- run: sudo apt-get -qq update
- name: Install libsystemd-dev
run: sudo apt-get install libsystemd-dev
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: ${{ env['ACTION_MINIMUM_TOOLCHAIN'] }}
- name: Go fmt
run: ./scripts/ci-runner.sh go_fmt
- name: Go build (source)
run: ./scripts/ci-runner.sh build_source
- name: Go build (tests)
run: ./scripts/ci-runner.sh build_tests
- name: Go vet
run: ./scripts/ci-runner.sh go_vet
- run: echo "All jobs completed"
1 change: 1 addition & 0 deletions internal/dlopen/dlopen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func TestDlopen(t *testing.T) {
// It depends on the fact the it first generates some dlerror() errors
// by using non existent libraries.
func TestDlopenThreadSafety(t *testing.T) {
t.Skip("panics in CI; see https://github.com/coreos/go-systemd/issues/462.")
libs := []string{
"libstrange1.so",
"libstrange2.so",
Expand Down
4 changes: 0 additions & 4 deletions scripts/ci-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
set -e
set -o pipefail

PROJ="go-systemd"
ORG_PATH="github.com/coreos"
REPO_PATH="${ORG_PATH}/${PROJ}"

PACKAGES="activation daemon dbus internal/dlopen journal login1 machine1 sdjournal unit util import1"
EXAMPLES="activation listen udpconn"

Expand Down