Skip to content

Commit 638e849

Browse files
committed
Switch to GitHub Actions for CI
1 parent 57f7eeb commit 638e849

File tree

10 files changed

+87
-97
lines changed

10 files changed

+87
-97
lines changed

.github/workflows/ci.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: CI
2+
on: push
3+
jobs:
4+
build-and-test:
5+
runs-on: ubuntu-20.04
6+
strategy:
7+
fail-fast: false
8+
matrix:
9+
include:
10+
- arch: amd64
11+
docker_image: debian:buster
12+
13+
- arch: arm64
14+
docker_image: arm64v8/debian:buster
15+
16+
- arch: ppc64le
17+
docker_image: ppc64le/debian:buster
18+
19+
- arch: s390x
20+
docker_image: s390x/debian:buster
21+
22+
env:
23+
BASE_IMAGE: ${{ matrix.docker_image }}
24+
25+
steps:
26+
- uses: actions/checkout@v2
27+
28+
- name: Set up QEMU
29+
id: qemu
30+
uses: docker/setup-qemu-action@v1
31+
if: ${{ matrix.arch != 'amd64' }}
32+
with:
33+
image: tonistiigi/binfmt:latest
34+
35+
- name: Build Docker image
36+
run: make docker-image
37+
38+
- name: Run python tests
39+
run: docker run --rm -v $(pwd):/mnt:rw dumb-init-build /mnt/ci/docker-python-test
40+
41+
- name: Build Debian package
42+
run: docker run --init --rm -v $(pwd):/mnt:rw dumb-init-build make -C /mnt builddeb
43+
44+
- name: Test built Debian package
45+
# XXX: This uses the clean base image (not the build one) to make
46+
# sure it installs in a clean image without any hidden dependencies.
47+
run: docker run --rm -v $(pwd):/mnt:rw ${{ matrix.docker_image }} /mnt/ci/docker-deb-test
48+
49+
- name: Upload build artifacts
50+
uses: actions/upload-artifact@v2
51+
with:
52+
name: ${{ matrix.arch }}
53+
path: dist
54+
55+
# TODO: switch to pre-commit.ci
56+
pre-commit:
57+
runs-on: ubuntu-20.04
58+
steps:
59+
- uses: actions/checkout@v2
60+
61+
- name: Set up Python
62+
uses: actions/setup-python@v2
63+
with:
64+
python-version: '3.8'
65+
66+
- name: Install tox
67+
run: pip install tox
68+
69+
- name: Run pre-commit
70+
run: tox -e pre-commit

.travis.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

Dockerfile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
FROM debian:buster
1+
ARG BASE_IMAGE=debian:buster
2+
FROM $BASE_IMAGE
23

34
LABEL maintainer="Chris Kuehl <[email protected]>"
45

5-
# The default mirrors are too flaky to run reliably in CI.
6-
RUN sed -E \
7-
'/security\.debian/! s@http://[^/]+/@http://mirrors.kernel.org/@' \
8-
-i /etc/apt/sources.list
9-
106
# Install the bare minimum dependencies necessary for working with Debian
117
# packages. Build dependencies should be added under "Build-Depends" inside
128
# debian/control instead.
@@ -17,6 +13,9 @@ RUN : \
1713
devscripts \
1814
equivs \
1915
lintian \
16+
python3-distutils \
17+
python3-setuptools \
18+
python3-pip \
2019
&& apt-get clean \
2120
&& rm -rf /var/lib/apt/lists/*
2221
WORKDIR /tmp/mnt
@@ -27,5 +26,3 @@ RUN : \
2726
&& mk-build-deps --install --tool 'apt-get -y --no-install-recommends' /control \
2827
&& apt-get clean \
2928
&& rm -rf /var/lib/apt/lists/*
30-
31-
ENTRYPOINT make builddeb

Makefile

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ builddeb:
5454
.PHONY: builddeb-docker
5555
builddeb-docker: docker-image
5656
mkdir -p dist
57-
docker run --user $$(id -u):$$(id -g) -v $(PWD):/tmp/mnt dumb-init-build
57+
docker run --init --user $$(id -u):$$(id -g) -v $(PWD):/tmp/mnt dumb-init-build make builddeb
5858

5959
.PHONY: docker-image
6060
docker-image:
61-
docker build -t dumb-init-build .
61+
docker build $(if $(BASE_IMAGE),--build-arg BASE_IMAGE=$(BASE_IMAGE)) -t dumb-init-build .
6262

6363
.PHONY: test
6464
test:
@@ -68,23 +68,3 @@ test:
6868
.PHONY: install-hooks
6969
install-hooks:
7070
tox -e pre-commit -- install -f --install-hooks
71-
72-
ITEST_TARGETS = itest_focal itest_buster
73-
74-
.PHONY: itest $(ITEST_TARGETS)
75-
itest: $(ITEST_TARGETS)
76-
77-
itest_focal: _itest-ubuntu-focal
78-
itest_buster: _itest-debian-buster
79-
80-
itest_tox:
81-
$(DOCKER_RUN_TEST) debian:buster /mnt/ci/docker-tox-test
82-
83-
_itest-%: _itest_deb-% _itest_python-%
84-
@true
85-
86-
_itest_python-%:
87-
$(DOCKER_RUN_TEST) $(shell sed 's/-/:/' <<< "$*") /mnt/ci/docker-python-test
88-
89-
_itest_deb-%: builddeb-docker
90-
$(DOCKER_RUN_TEST) $(shell sed 's/-/:/' <<< "$*") /mnt/ci/docker-deb-test

ci/docker

Lines changed: 0 additions & 18 deletions
This file was deleted.

ci/docker-deb-test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/bin/bash -eux
22
set -o pipefail
33

4-
. /mnt/ci/docker
4+
apt-get update
5+
apt-get -y --no-install-recommends install python3-pip procps
56

7+
cd /mnt
68
dpkg -i dist/*.deb
79
pip3 install -r requirements-dev.txt
810
pytest tests/

ci/docker-python-test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/bin/bash -eux
2-
set -o pipefail
2+
set -euo pipefail
33

4-
. /mnt/ci/docker
4+
cd /mnt
55

66
python3 setup.py clean
77
python3 setup.py sdist
88
pip3 install -vv dist/*.tar.gz
99
pip3 install -r requirements-dev.txt
10-
pytest tests/
10+
pytest-3 -vv tests/
1111

1212
exec dumb-init /mnt/tests/test-zombies

ci/docker-tox-test

Lines changed: 0 additions & 12 deletions
This file was deleted.

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[pytest]
2-
timeout = 5
2+
timeout = 20

tox.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py37,gcov
2+
envlist = py38,gcov
33

44
[testenv]
55
deps = -r{toxinidir}/requirements-dev.txt
@@ -8,14 +8,14 @@ commands =
88

99
[testenv:gcov]
1010
skip_install = True
11-
basepython = /usr/bin/python3.7
11+
basepython = /usr/bin/python3.8
1212
commands =
1313
{toxinidir}/ci/gcov-build {envbindir}
1414
{[testenv]commands}
1515
{toxinidir}/ci/gcov-report
1616

1717
[testenv:pre-commit]
18-
basepython = /usr/bin/python3.7
18+
basepython = /usr/bin/python3.8
1919
commands = pre-commit {posargs:run --all-files}
2020

2121
[flake8]

0 commit comments

Comments
 (0)