Skip to content

Commit

Permalink
workflows: add container tests
Browse files Browse the repository at this point in the history
This moves the remaining distribution tests from Travis to GitHub
workflows.
  • Loading branch information
lucab committed Nov 20, 2020
1 parent c9fea21 commit 277d865
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 42 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Containers

on:
push:
branches: [master]
pull_request:
branches: [master]

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

jobs:
ditro-test:
name: "Distro test"
runs-on: ubuntu-latest
strategy:
matrix:
baseimage: ['debian:stretch', 'ubuntu:16.04', 'ubuntu:18.04']
steps:
- run: sudo apt-get -qq update
- name: Install libsystemd-dev
run: sudo apt-get install libsystemd-dev
- uses: actions/checkout@v2
- name: Setup go
uses: actions/setup-go@v1
with:
go-version: ${{ env['GO_TOOLCHAIN'] }}
- name: Go build (source)
run: ./scripts/travis/pr-test.sh build_source
- name: Go build (tests)
run: ./scripts/travis/pr-test.sh build_tests
- 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 "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
- 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
- name: Run tests
run: docker exec --privileged `cat /tmp/cidfile` /bin/bash -c "cd ${BUILD_DIR} && ./scripts/travis/pr-test.sh run_tests"
- name: Cleanup
run: docker kill `cat /tmp/cidfile`
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
build:
name: "Build"
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
go: ['1.14', '1.15']
steps:
- run: sudo apt-get -qq update
- name: Install libsystemd-dev
run: sudo apt-get install libsystemd-dev
- uses: actions/checkout@v2
Expand All @@ -37,8 +37,8 @@ jobs:
build-minimum:
name: "Build on minimum supported toolchain"
runs-on: ubuntu-latest
continue-on-error: true
steps:
- run: sudo apt-get -qq update
- name: Install libsystemd-dev
run: sudo apt-get install libsystemd-dev
- uses: actions/checkout@v2
Expand Down
40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

0 comments on commit 277d865

Please sign in to comment.