Commit 0a6d23e8 authored by Godefroid Chapelle's avatar Godefroid Chapelle

run tests in CentOS container on Github Actions

parent 6e4eb0d9
pythons
python_builds
download_cache
parts
eggs
venvs
.cache
lib
**/__pycache__
**/*.pyc
.git
FROM centos as centos-python
RUN yum install -y make gcc openssl-devel libffi-devel
ARG PYTHON_VER
ENV LC_CTYPE="en_US.UTF-8"
RUN mkdir buildout
WORKDIR /buildout
COPY Makefile Makefile.configure /buildout/
RUN make PYTHON_VER=${PYTHON_VER} download_python
RUN make PYTHON_VER=${PYTHON_VER} python
FROM centos-python
ARG PYTHON_VER
COPY doc /buildout/doc
COPY src /buildout/src
COPY zc.recipe.egg_ /buildout/zc.recipe.egg_
COPY setup.* dev.py *.rst *.txt buildout.cfg /buildout/
RUN make PYTHON_VER=${PYTHON_VER} build
name: Buildout on Centos
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Build container with Python ${{ matrix.python-version }}
env:
PYTHON_VER: ${{matrix.python-version}}
run: |
docker build -f .github/workflows/Dockerfile --tag centos_buildout:python${PYTHON_VER} --build-arg PYTHON_VER=${PYTHON_VER} .
- name: Test
env:
PYTHON_VER: ${{matrix.python-version}}
run: |
docker run centos_buildout:python${PYTHON_VER} /buildout/bin/test -c -vvv
HERE = $(shell pwd) HERE = $(shell pwd)
PYTHON_VER ?= 2.7 PYTHON_VER ?= 3.7
PYTHON_PATH = $(HERE)/pythons/$(PYTHON_VER) PYTHON_PATH = $(HERE)/pythons/$(PYTHON_VER)
PYTHON_BUILD_DIR = $(HERE)/python_builds PYTHON_BUILD_DIR = $(HERE)/python_builds
PLATFORM = $(shell uname)
VENV = $(HERE)/venvs/$(PYTHON_VER)
BUILD_VARIABLES =
ifeq ($(PYTHON_VER),2.7) ifeq ($(PYTHON_VER),2.7)
PYTHON_MINOR ?= 2.7.13 PYTHON_MINOR ?= 2.7.17
endif
ifeq ($(PYTHON_VER),3.4)
PYTHON_MINOR ?= 3.4.6
PYTHON_CONFIGURE_ARGS ?= --without-ensurepip
endif endif
ifeq ($(PYTHON_VER),3.5) ifeq ($(PYTHON_VER),3.5)
PYTHON_MINOR ?= 3.5.3 PYTHON_MINOR ?= 3.5.9
PYTHON_CONFIGURE_ARGS ?= --without-ensurepip
endif endif
ifeq ($(PYTHON_VER),3.6) ifeq ($(PYTHON_VER),3.6)
PYTHON_MINOR ?= 3.6.0 PYTHON_MINOR ?= 3.6.10
PYTHON_CONFIGURE_ARGS ?= --without-ensurepip endif
ifeq ($(PYTHON_VER),3.7)
PYTHON_MINOR ?= 3.7.7
endif
ifeq ($(PYTHON_VER),3.8)
PYTHON_MINOR ?= 3.8.2
endif
ifeq ($(PYTHON_VER),3.9)
PYTHON_MINOR ?= 3.9.0
PYTHON_ARCHIVE ?= Python-3.9.0a6
endif endif
ifndef PYTHON_MINOR ifndef PYTHON_MINOR
$(error Please specify desired PYTHON_MINOR for Python $(PYTHON_VER)) $(error Please specify desired PYTHON_MINOR for Python $(PYTHON_VER))
endif endif
ifeq ($(PLATFORM),Darwin)
include Makefile.configure.Darwin
else
include Makefile.configure
endif
PYTHON_ARCHIVE ?= Python-$(PYTHON_MINOR) PYTHON_ARCHIVE ?= Python-$(PYTHON_MINOR)
PYTHON_DOWNLOAD = https://www.python.org/ftp/python/$(PYTHON_MINOR)/$(PYTHON_ARCHIVE).tgz PYTHON_URL = https://www.python.org/ftp/python/$(PYTHON_MINOR)/$(PYTHON_ARCHIVE).tgz
PYTHON_EXE = python$(PYTHON_VER) PYTHON_EXE = python$(PYTHON_VER)
PYTHON_DOWNLOAD = $(PYTHON_BUILD_DIR)/$(PYTHON_ARCHIVE).tgz
.PHONY: all build test
BUILD_DIRS = $(PYTHON_PATH) bin build develop-eggs eggs parts BUILD_DIRS = $(PYTHON_PATH) bin build develop-eggs eggs parts
all: build all: test
.PHONY: all download_python python build test docker clean
$(PYTHON_PATH)/bin/$(PYTHON_EXE): # setup python from source
$(PYTHON_DOWNLOAD):
mkdir -p $(PYTHON_BUILD_DIR)
curl --progress-bar --location $(PYTHON_URL) -o $(PYTHON_DOWNLOAD)
$(PYTHON_BUILD_DIR)/$(PYTHON_ARCHIVE)/configure: $(PYTHON_DOWNLOAD)
cd $(PYTHON_BUILD_DIR) && tar -xzf $(PYTHON_DOWNLOAD)
touch $@
$(PYTHON_PATH)/bin/$(PYTHON_EXE): $(PYTHON_BUILD_DIR)/$(PYTHON_ARCHIVE)/configure
@echo "Installing Python" @echo "Installing Python"
rm -rf $(PYTHON_PATH)
mkdir -p $(PYTHON_PATH) mkdir -p $(PYTHON_PATH)
mkdir -p $(PYTHON_BUILD_DIR)
cd $(PYTHON_BUILD_DIR) && \
curl --progress-bar --location $(PYTHON_DOWNLOAD) | tar -zx
cd $(PYTHON_BUILD_DIR)/$(PYTHON_ARCHIVE) && \ cd $(PYTHON_BUILD_DIR)/$(PYTHON_ARCHIVE) && \
./configure --prefix $(PYTHON_PATH) $(PYTHON_CONFIGURE_ARGS) >/dev/null 2>&1 && \ $(BUILD_VARIABLES) ./configure --prefix $(PYTHON_PATH) $(PYTHON_CONFIGURE_ARGS) >/dev/null 2>&1 && \
make >/dev/null 2>&1 && \ make >/dev/null 2>&1 && \
make install >/dev/null 2>&1 make install >/dev/null 2>&1
@echo "Finished installing Python" @echo "Finished installing Python"
build: $(PYTHON_PATH)/bin/$(PYTHON_EXE) download_python: $(PYTHON_BUILD_DIR)/$(PYTHON_ARCHIVE)/configure
python: $(PYTHON_PATH)/bin/$(PYTHON_EXE)
# used by Dockerfile
build: python
$(PYTHON_PATH)/bin/$(PYTHON_EXE) dev.py $(PYTHON_PATH)/bin/$(PYTHON_EXE) dev.py
docker:
docker build -f .github/workflows/Dockerfile --tag centos_buildout:python${PYTHON_VER} --build-arg PYTHON_VER=${PYTHON_VER} .
docker run centos_buildout:python${PYTHON_VER} /buildout/bin/test -c -vvv -t abi
clean: clean:
rm -rf $(BUILD_DIRS) $(PYTHON_BUILD_DIR) rm -rf $(BUILD_DIRS) $(PYTHON_BUILD_DIR)
......
ifeq ($(PYTHON_VER),2.7)
PYTHON_CONFIGURE_ARGS ?=
endif
ifeq ($(PYTHON_VER),3.5)
PYTHON_CONFIGURE_ARGS ?= --without-ensurepip
endif
ifeq ($(PYTHON_VER),3.6)
PYTHON_CONFIGURE_ARGS ?= --without-ensurepip
endif
ifeq ($(PYTHON_VER),3.7)
PYTHON_CONFIGURE_ARGS ?= --without-ensurepip
endif
ifeq ($(PYTHON_VER),3.8)
PYTHON_CONFIGURE_ARGS ?= --without-ensurepip
endif
OPENSSL = $(shell brew --prefix openssl)
ifeq ($(PYTHON_VER),2.7)
BUILD_VARIABLES = LDFLAGS="-L$(OPENSSL)/lib" CPPFLAGS="-I$(OPENSSL)/include"
PYTHON_CONFIGURE_ARGS ?=
endif
ifeq ($(PYTHON_VER),3.5)
BUILD_VARIABLES = LDFLAGS="-L$(OPENSSL)/lib" CPPFLAGS="-I$(OPENSSL)/include"
PYTHON_CONFIGURE_ARGS ?= --without-ensurepip
endif
ifeq ($(PYTHON_VER),3.6)
BUILD_VARIABLES = LDFLAGS="-L$(OPENSSL)/lib" CPPFLAGS="-I$(OPENSSL)/include"
PYTHON_CONFIGURE_ARGS ?= --without-ensurepip
endif
ifeq ($(PYTHON_VER),3.7)
PYTHON_CONFIGURE_ARGS ?= --without-ensurepip --with-openssl=$(OPENSSL)
endif
ifeq ($(PYTHON_VER),3.8)
PYTHON_CONFIGURE_ARGS ?= --without-ensurepip --with-openssl=$(OPENSSL)
endif
ifeq ($(PYTHON_VER),3.9)
PYTHON_CONFIGURE_ARGS ?= --without-ensurepip --with-openssl=$(OPENSSL)
endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment