Skip to content

Commit 87511f3

Browse files
author
Luca Bruno
authored
Merge pull request coreos#348 from lucab/ups/gh-container
workflows: add container tests
2 parents c9fea21 + 277d865 commit 87511f3

File tree

3 files changed

+49
-42
lines changed

3 files changed

+49
-42
lines changed

.github/workflows/containers.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: Containers
3+
4+
on:
5+
push:
6+
branches: [master]
7+
pull_request:
8+
branches: [master]
9+
10+
env:
11+
GO_TOOLCHAIN: "1.15"
12+
GOPATH: "/opt"
13+
BUILD_DIR: "/opt/src/github.com/coreos/go-systemd"
14+
15+
jobs:
16+
ditro-test:
17+
name: "Distro test"
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
baseimage: ['debian:stretch', 'ubuntu:16.04', 'ubuntu:18.04']
22+
steps:
23+
- run: sudo apt-get -qq update
24+
- name: Install libsystemd-dev
25+
run: sudo apt-get install libsystemd-dev
26+
- uses: actions/checkout@v2
27+
- name: Setup go
28+
uses: actions/setup-go@v1
29+
with:
30+
go-version: ${{ env['GO_TOOLCHAIN'] }}
31+
- name: Go build (source)
32+
run: ./scripts/travis/pr-test.sh build_source
33+
- name: Go build (tests)
34+
run: ./scripts/travis/pr-test.sh build_tests
35+
- name: Pull base image - ${{ matrix.baseimage }}
36+
run: docker pull ${{ matrix.baseimage }}
37+
- name: Install packages for ${{ matrix.baseimage }}
38+
run: docker run --privileged -e GOPATH=${GOPATH} --cidfile=/tmp/cidfile ${{ matrix.baseimage }} /bin/bash -c "apt-get update && apt-get install -y sudo build-essential git golang dbus libsystemd-dev libpam-systemd systemd-container"
39+
- name: Persist base container
40+
run: docker commit `cat /tmp/cidfile` go-systemd/container-tests
41+
- run: rm -f /tmp/cidfile
42+
- name: Run systemd from ${{ matrix.baseimage }}
43+
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
44+
- name: Run tests
45+
run: docker exec --privileged `cat /tmp/cidfile` /bin/bash -c "cd ${BUILD_DIR} && ./scripts/travis/pr-test.sh run_tests"
46+
- name: Cleanup
47+
run: docker kill `cat /tmp/cidfile`

.github/workflows/go.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ jobs:
1414
build:
1515
name: "Build"
1616
runs-on: ubuntu-latest
17-
continue-on-error: true
1817
strategy:
1918
matrix:
2019
go: ['1.14', '1.15']
2120
steps:
21+
- run: sudo apt-get -qq update
2222
- name: Install libsystemd-dev
2323
run: sudo apt-get install libsystemd-dev
2424
- uses: actions/checkout@v2
@@ -37,8 +37,8 @@ jobs:
3737
build-minimum:
3838
name: "Build on minimum supported toolchain"
3939
runs-on: ubuntu-latest
40-
continue-on-error: true
4140
steps:
41+
- run: sudo apt-get -qq update
4242
- name: Install libsystemd-dev
4343
run: sudo apt-get install libsystemd-dev
4444
- uses: actions/checkout@v2

.travis.yml

-40
This file was deleted.

0 commit comments

Comments
 (0)