Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into upstream_v1.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
t-lesniewski-sr committed Jun 24, 2024
2 parents 5f05558 + 5ccca9c commit da3df66
Show file tree
Hide file tree
Showing 29 changed files with 326 additions and 217 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI
on: push
jobs:
build-and-test:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
manylinux_arch: x86_64
docker_image: debian:buster

- arch: arm64
manylinux_arch: aarch64
docker_image: arm64v8/debian:buster

- arch: ppc64le
manylinux_arch: ppc64le
docker_image: ppc64le/debian:buster

- arch: s390x
manylinux_arch: s390x
docker_image: s390x/debian:buster

env:
BASE_IMAGE: ${{ matrix.docker_image }}

steps:
- uses: actions/checkout@v2

- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
if: ${{ matrix.arch != 'amd64' }}
with:
image: tonistiigi/binfmt:latest

- name: Build Docker image
run: make docker-image

- name: Run python tests
run: docker run --rm -v $(pwd):/mnt:rw dumb-init-build /mnt/ci/docker-python-test

- name: Build Debian package
run: docker run --init --rm -v $(pwd):/mnt:rw dumb-init-build make -C /mnt builddeb

- name: Test built Debian package
# XXX: This uses the clean base image (not the build one) to make
# sure it installs in a clean image without any hidden dependencies.
run: docker run --rm -v $(pwd):/mnt:rw ${{ matrix.docker_image }} /mnt/ci/docker-deb-test

- name: Build wheels
run: sudo make python-dists-${{ matrix.manylinux_arch }}

- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.arch }}
path: dist
25 changes: 19 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.2.3
rev: v4.4.0
hooks:
- id: autopep8-wrapper
- id: check-added-large-files
- id: check-docstring-first
- id: check-executables-have-shebangs
Expand All @@ -12,19 +11,33 @@ repos:
- id: detect-private-key
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: flake8
- id: name-tests-test
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.0
hooks:
- id: autopep8
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/asottile/reorder_python_imports
rev: v1.0.1
rev: v3.9.0
hooks:
- id: reorder-python-imports
args: ['--py3-plus']
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.5
rev: v1.3.1
hooks:
- id: remove-tabs
- repo: https://github.com/asottile/pyupgrade
rev: v1.11.3
rev: v3.3.0
hooks:
- id: pyupgrade
args: ['--py3-plus']
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.3.0
hooks:
- id: add-trailing-comma
args: ['--py36-plus']
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ The process to release a new version is:
4. Commit the changes and tag the commit like `v1.0.0`.
5. `git push --tags origin master`
6. Wait for Travis to run, then find and download the binary and Debian
packages for both amd64 and ppc64el; there will be links printed at the end
of the Travis output. Put these into your `dist` directory.
packages for all architectures; there will be links printed at the
end of the Travis output. Put these into your `dist` directory.
7. Run `make release`
8. Run `twine upload --skip-existing dist/*.tar.gz dist/*.whl` to upload the
new version to PyPI
9. Upload the resulting Debian package, binary (inside the `dist` directory),
and sha256sums file to a new [GitHub
9. Upload the resulting Debian packages, binaries, and sha256sums file (all
inside the `dist` directory) to a new [GitHub
release](https://github.com/Yelp/dumb-init/releases)
30 changes: 17 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
FROM debian:stretch
ARG BASE_IMAGE=debian:buster
FROM $BASE_IMAGE

LABEL maintainer="Chris Kuehl <ckuehl@yelp.com>"

# The default mirrors are too flaky to run reliably in CI.
RUN sed -E \
'/security\.debian/! s@http://[^/]+/@http://mirrors.kernel.org/@' \
-i /etc/apt/sources.list

# Install the bare minimum dependencies necessary for working with Debian
# packages. Build dependencies should be added under "Build-Depends" inside
# debian/control instead.
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
apt-get install -y --no-install-recommends \
RUN : \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
devscripts \
equivs \
lintian \
&& rm -rf /var/lib/apt/lists/* && apt-get clean
WORKDIR /mnt
python3-distutils \
python3-setuptools \
python3-pip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /tmp/mnt

ENTRYPOINT apt-get update && \
mk-build-deps -i --tool 'apt-get --no-install-recommends -y' && \
make builddeb
COPY debian/control /control
RUN : \
&& apt-get update \
&& mk-build-deps --install --tool 'apt-get -y --no-install-recommends' /control \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
41 changes: 11 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,21 @@ clean-tox:
.PHONY: release
release: python-dists
cd dist && \
sha256sum --binary dumb-init_$(VERSION)_amd64.deb dumb-init_$(VERSION)_amd64 dumb-init_$(VERSION)_ppc64el.deb dumb-init_$(VERSION)_ppc64el \
sha256sum --binary dumb-init_$(VERSION)_amd64.deb dumb-init_$(VERSION)_x86_64 dumb-init_$(VERSION)_ppc64el.deb dumb-init_$(VERSION)_ppc64le dumb-init_$(VERSION)_s390x.deb dumb-init_$(VERSION)_s390x dumb-init_$(VERSION)_arm64.deb dumb-init_$(VERSION)_aarch64 \
> sha256sums

.PHONY: python-dists
python-dists: VERSION.h
python-dists: python-dists-x86_64 python-dists-aarch64 python-dists-ppc64le python-dists-s390x

.PHONY: python-dists-%
python-dists-%: VERSION.h
python setup.py sdist
docker run \
--user $$(id -u):$$(id -g) \
-v $(PWD)/dist:/dist:rw \
quay.io/pypa/manylinux1_x86_64:latest \
-v `pwd`/dist:/dist:rw \
quay.io/pypa/manylinux2014_$*:latest \
bash -exc ' \
/opt/python/cp35-cp35m/bin/pip wheel --wheel-dir /tmp /dist/*.tar.gz && \
/opt/python/cp38-cp38/bin/pip wheel --wheel-dir /tmp /dist/*.tar.gz && \
auditwheel repair --wheel-dir /dist /tmp/*.whl --wheel-dir /dist \
'

Expand All @@ -49,16 +52,16 @@ builddeb:
# Extract the built binary from the Debian package
dpkg-deb --fsys-tarfile dist/dumb-init_$(VERSION)_$(shell dpkg --print-architecture).deb | \
tar -C dist --strip=3 -xvf - ./usr/bin/dumb-init
mv dist/dumb-init dist/dumb-init_$(VERSION)_$(shell dpkg --print-architecture)
mv dist/dumb-init dist/dumb-init_$(VERSION)_$(shell uname -m)

.PHONY: builddeb-docker
builddeb-docker: docker-image
mkdir -p dist
docker run -v $(PWD):/mnt dumb-init-build
docker run --init --user $$(id -u):$$(id -g) -v $(PWD):/tmp/mnt dumb-init-build make builddeb

.PHONY: docker-image
docker-image:
docker build -t dumb-init-build .
docker build $(if $(BASE_IMAGE),--build-arg BASE_IMAGE=$(BASE_IMAGE)) -t dumb-init-build .

.PHONY: test
test:
Expand All @@ -68,25 +71,3 @@ test:
.PHONY: install-hooks
install-hooks:
tox -e pre-commit -- install -f --install-hooks

ITEST_TARGETS = itest_trusty itest_xenial itest_bionic itest_stretch

.PHONY: itest $(ITEST_TARGETS)
itest: $(ITEST_TARGETS)

itest_trusty: _itest-ubuntu-trusty
itest_xenial: _itest-ubuntu-xenial
itest_bionic: _itest-ubuntu-bionic
itest_stretch: _itest-debian-stretch

itest_tox:
$(DOCKER_RUN_TEST) ubuntu:bionic /mnt/ci/docker-tox-test

_itest-%: _itest_deb-% _itest_python-%
@true

_itest_python-%:
$(DOCKER_RUN_TEST) $(shell sed 's/-/:/' <<< "$*") /mnt/ci/docker-python-test

_itest_deb-%: builddeb-docker
$(DOCKER_RUN_TEST) $(shell sed 's/-/:/' <<< "$*") /mnt/ci/docker-deb-test
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
dumb-init
========

[![Travis CI](https://travis-ci.org/Yelp/dumb-init.svg?branch=master)](https://travis-ci.org/Yelp/dumb-init/)
[![PyPI version](https://badge.fury.io/py/dumb-init.svg)](https://pypi.python.org/pypi/dumb-init)


Expand Down Expand Up @@ -174,7 +173,7 @@ If you don't have an internal apt server, you can use `dpkg -i` to install the
One possibility is with the following commands in your Dockerfile:

```Dockerfile
RUN wget https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64.deb
RUN wget https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_amd64.deb
RUN dpkg -i dumb-init_*.deb
```

Expand All @@ -185,7 +184,7 @@ Since dumb-init is released as a statically-linked binary, you can usually just
plop it into your images. Here's an example of doing that in a Dockerfile:

```Dockerfile
RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64
RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64
RUN chmod +x /usr/local/bin/dumb-init
```

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.2
1.2.5
2 changes: 1 addition & 1 deletion VERSION.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS FILE IS AUTOMATICALLY GENERATED
// Run `make VERSION.h` to update it after modifying VERSION.
unsigned char VERSION[] = {
0x31, 0x2e, 0x32, 0x2e, 0x32, 0x0a
0x31, 0x2e, 0x32, 0x2e, 0x35, 0x0a
};
unsigned int VERSION_len = 6;
18 changes: 0 additions & 18 deletions ci/docker

This file was deleted.

8 changes: 5 additions & 3 deletions ci/docker-deb-test
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/bash -eux
set -o pipefail

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

cd /mnt
dpkg -i dist/*.deb
pip install -r requirements-dev.txt
py.test tests/
pip3 install -r requirements-dev.txt
pytest tests/

exec dumb-init /mnt/tests/test-zombies
16 changes: 8 additions & 8 deletions ci/docker-python-test
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash -eux
set -o pipefail
set -euo pipefail

. /mnt/ci/docker
cd /mnt

python setup.py clean
python setup.py sdist
pip install -vv dist/*.tar.gz
pip install -r requirements-dev.txt
py.test tests/
python3 setup.py clean
python3 setup.py sdist
pip3 install -vv dist/*.tar.gz
pip3 install -r requirements-dev.txt
pytest-3 -vv tests/

exec dumb-init /mnt/tests/test-zombies \
exec dumb-init /mnt/tests/test-zombies
13 changes: 0 additions & 13 deletions ci/docker-tox-test

This file was deleted.

Loading

0 comments on commit da3df66

Please sign in to comment.