Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test target to current Ubuntu #161

Merged
merged 10 commits into from
Jan 9, 2023
20 changes: 18 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
- "ubuntu-22.04-jammy-arm64v8"
- "ubuntu-22.04-jammy-ppc64le"
- "ubuntu-22.04-jammy-s390x"
# test image for manylinux-wheel build
- "ubuntu-22.04-jammy-amd64"
# Then run the remainder
- "alpine"
- "amazon-2-amd64"
Expand All @@ -33,12 +35,14 @@ jobs:
- "fedora-36-amd64"
- "fedora-37-amd64"
- "gentoo"
- "manylinux2014-wheel-build"
- "ubuntu-18.04-bionic-amd64"
- "ubuntu-20.04-focal-amd64"
- "ubuntu-22.04-jammy-amd64"
- "ubuntu-22.04-jammy-amd64-valgrind"
# has a dependency on the test image
- "manylinux2014-wheel-build"
include:
- image: "manylinux2014-wheel-build"
test-image: "ubuntu-22.04-jammy-amd64"
- image: "ubuntu-22.04-jammy-arm64v8"
qemu-arch: "aarch64"
- image: "ubuntu-22.04-jammy-ppc64le"
Expand All @@ -65,6 +69,14 @@ jobs:
fi
sudo chown -R 1000 $(pwd)

- name: Test Image Build
if: "matrix.test-image"
run: |
cd "${{ matrix.test-image }}"
make pull || (sudo chmod a+w . && make update && make build BRANCH=main)
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}

- name: Build image
id: build
run: |
Expand All @@ -81,6 +93,8 @@ jobs:
run: |
cd "${{ matrix.image }}"
make test BRANCH=main
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}

- name: Log image size
run: |
Expand All @@ -92,6 +106,8 @@ jobs:
&& github.ref == 'refs/heads/main'
&& matrix.target == 'latest'"
run: make push-${{ matrix.image }} BRANCH=main
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}

- name: Post build
if: always()
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ TARGETS = \

BUILDDIRS = $(TARGETS:%=build-%)
PUSHDIRS = $(TARGETS:%=push-%)
PULLDIRS = $(TARGETS:%=pull-%)
UPDATEDIRS = $(TARGETS:%=update-%)
CLEANDIRS = $(TARGETS:%=clean-%)
TESTDIRS = $(TARGETS:%=test-%)

.PHONY: build update push test $(TARGETS)
.PHONY: subdirs $(BUILDDIRS)
.PHONY: subdirs $(PUSHDIRS)
.PHONY: subdirs $(PULLDIRS)
.PHONY: subdirs $(UPDATEDIRS)
.PHONY: subdirs $(CLEANDIRS)
.PHONY: subdirs $(TESTDIRS)
Expand All @@ -41,6 +43,10 @@ push: $(PUSHDIRS)
$(PUSHDIRS):
$(MAKE) -C $(@:push-%=%) push

pull: $(PULLDIRS)
$(PULLDIRS):
$(MAKE) -C $(@:pull-%=%) pull

update: $(UPDATEDIRS)
$(UPDATEDIRS):
$(MAKE) -C $(@:update-%=%) update
Expand Down
8 changes: 6 additions & 2 deletions Makefile.sub
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
WD = $(shell pwd)
USERNAME := $(shell docker info | grep Username | xargs | cut -d ' ' -f 2)
TARGET := $(notdir $(WD))
ROOT := $(abspath $(WD)/../Pillow)
IMAGENAME := $(if $(USERNAME), $(USERNAME)/$(TARGET), $(TARGET))
IMAGENAME := $(if $(DOCKER_USERNAME), $(DOCKER_USERNAME)/$(TARGET), $(TARGET))
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
TEST_IMAGE := $(if $(DOCKER_USERNAME), $(DOCKER_USERNAME)/$(TARGET):$(BRANCH), pythonpillow/$(TARGET):main)

.PHONY: build
build:
Expand All @@ -23,6 +23,10 @@ test:
push:
docker push $(IMAGENAME):$(BRANCH)

.PHONY: pull
pull:
docker pull $(TEST_IMAGE)

.PHONY: clean
clean:
rm -r depends
Expand Down
14 changes: 8 additions & 6 deletions manylinux2014-wheel-build/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
WD = $(shell pwd)
USERNAME := $(shell docker info | grep Username | xargs | cut -d ' ' -f 2)
TARGET := $(notdir $(WD))
ROOT := $(abspath $(WD)/../Pillow)
IMAGENAME := $(if $(USERNAME), $(USERNAME)/$(TARGET), $(TARGET))
IMAGENAME := $(if $(DOCKER_USERNAME), $(DOCKER_USERNAME)/$(TARGET), $(TARGET))
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
TEST_TARGET = ubuntu-20.04-focal-amd64
TEST_IMAGE=pythonpillow/$(TEST_TARGET)
TEST_TARGET = ubuntu-22.04-jammy-amd64
TEST_IMAGE := $(if $(DOCKER_USERNAME), $(DOCKER_USERNAME)/$(TEST_TARGET):$(BRANCH), pythonpillow/$(TEST_TARGET):main)

.PHONY: build
build:
docker build -t $(IMAGENAME):$(BRANCH) .
Expand All @@ -27,10 +27,12 @@ wheel:
_PYVER=39 $(MAKE) wheel
310:
_PYVER=310 $(MAKE) wheel
311:
_PYVER=311 $(MAKE) wheel

.PHONY: test
test: 38
docker run --rm -v $(ROOT):/Pillow -v `pwd`/out:/output $(TEST_IMAGE):$(BRANCH) sh -c "/vpy3/bin/pip install /output/*cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl && cd /Pillow && /vpy3/bin/python selftest.py && /usr/bin/xvfb-run -a /vpy3/bin/pytest -vx"
test: 310
docker run --rm -v $(ROOT):/Pillow -v `pwd`/out:/output $(TEST_IMAGE) sh -c "/vpy3/bin/pip install /output/*cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl && cd /Pillow && /vpy3/bin/python selftest.py && /usr/bin/xvfb-run -a /vpy3/bin/pytest -vx"

.PHONY: push
push:
Expand Down
4 changes: 2 additions & 2 deletions manylinux2014-wheel-build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ symbols for debugging with Valgrind/GDB.

The Makefile has several new commands:

* make wheel: Makes a Python 3.8 manylinux2014 wheel, and puts it in the
* make wheel: Makes a Python 3.10 manylinux2014 wheel, and puts it in the
./out directory.
* make 37|38|39|310: These are specific commands to make
* make 37|38|39|310|311: These are specific commands to make
the corresponding 3.x version in the ./out directory.

The test target here is mainly to validate the image build, it is
Expand Down
4 changes: 2 additions & 2 deletions manylinux2014-wheel-build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ fi
# not strictly necessary, unless running multiple versions from the shell
rm -f /tmp/*.whl || true

# Python version, as 37,38,39,310. Defaults to 38.
# Python version, as 37,38,39,310,311. Defaults to 310.
# Matches the naming in /opt/python/
PYVER=${1:-38}
PYVER=${1:-310}
PYBIN=$(echo /opt/python/cp${PYVER}*/bin)

# We have to clean up the Pillow directories, otherwise we might get
Expand Down