Refactor CI (#492)

* Use cibuildwheel to build wheels.
* Use matrix
This commit is contained in:
Inada Naoki 2021-11-25 14:43:55 +09:00 committed by GitHub
parent 6129789e9f
commit bdf0511e29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 100 additions and 441 deletions

View file

@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v1 uses: actions/setup-python@v2
with: with:
python-version: '3.x' python-version: '3.x'
architecture: 'x64' architecture: 'x64'

View file

@ -1,103 +0,0 @@
name: Build Linux Wheels
on:
push:
pull_request:
create:
jobs:
build:
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Cythonize
shell: bash
run: |
pip install -U pip
pip -V
pip install -r requirements.txt
make cython
#python setup.py sdist
- name: Build wheels
shell: bash
run: |
make linux-wheel
- name: Install qemu-user-static for docker
shell: bash
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Build arm64 wheels
shell: bash
run: |
make linux-arm64-wheel
- name: Run test (3.8)
run: |
pip install pytest
pip install -v msgpack --only-binary :all: --no-index -f dist/wheelhouse
pytest -v test
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: "3.10"
- name: Run test (3.10)
run: |
pip install pytest
pip install -v msgpack --only-binary :all: --no-index -f dist/wheelhouse
pytest -v test
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Run test (3.9)
run: |
pip install pytest
pip install -v msgpack --only-binary :all: --no-index -f dist/wheelhouse
pytest -v test
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Run test (3.7)
run: |
pip install pytest
pip install -v msgpack --only-binary :all: --no-index -f dist/wheelhouse
pytest -v test
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Run test (3.6)
run: |
pip install pytest
pip install -v msgpack --only-binary :all: --no-index -f dist/wheelhouse
pytest -v test
- name: Upload Wheels
uses: actions/upload-artifact@v1
with:
name: linux-wheels
path: ./dist/wheelhouse/

View file

@ -1,80 +0,0 @@
name: Build macOS Wheels
on:
push:
create:
jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v1
# Python 3.9
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: "3.9"
- name: Cythonize
run: |
pip install -U pip
pip install -r requirements.txt
make cython
- name: Build wheels
uses: pypa/cibuildwheel@v2.2.2
env:
CIBW_ARCHS_MACOS: x86_64 universal2
CIBW_SKIP: pp*
- name: Run test
run: |
ls wheelhouse/
pip install pytest
pip install -v msgpack --only-binary :all: -f wheelhouse/ --no-index
pytest -v test
# Python 3.10
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: "3.10"
- name: Run test
run: |
pip install pytest
pip install -v msgpack --only-binary :all: -f wheelhouse/ --no-index
pytest -v test
# Python 3.8
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: "3.8"
- name: Run test
run: |
pip install pytest
pip install -v msgpack --only-binary :all: -f wheelhouse/ --no-index
pytest -v test
# Python 3.7
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: "3.7"
- name: Run test
run: |
pip install pytest
pip install -v msgpack --only-binary :all: -f wheelhouse/ --no-index
pytest -v test
- name: Upload Wheels
uses: actions/upload-artifact@v1
with:
name: macos-wheels
path: ./wheelhouse/

45
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,45 @@
name: Run tests
on:
push:
branches: [main]
pull_request:
create:
jobs:
test:
strategy:
matrix:
os: [ubuntu-20.04, windows-2022, macos-10.15]
py: ["3.10", "3.9", "3.8", "3.7", "3.6"]
runs-on: ${{ matrix.os }}
name: Run test with Python ${{ matrix.py }} on ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py }}
cache: "pip"
- name: Build
shell: bash
run: |
pip install -U pip
pip install -r requirements.txt pytest
make cython
pip install .
- name: Test (C extension)
shell: bash
run: |
pytest -v test
- name: Test (pure Python fallback)
shell: bash
run: |
MSGPACK_PUREPYTHON=1 pytest -v test

51
.github/workflows/wheel.yml vendored Normal file
View file

@ -0,0 +1,51 @@
name: Build Wheels
on:
push:
branches: [main]
create:
jobs:
build_wheels:
strategy:
matrix:
os: [ubuntu-20.04, windows-2022, macos-10.15]
runs-on: ${{ matrix.os }}
name: Build wheels on ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v1
with:
platforms: arm64
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
cache: "pip"
- name: Prepare
shell: bash
run: |
pip install -r requirements.txt
make cython
- name: Build
uses: pypa/cibuildwheel@v2.2.2
env:
CIBW_TEST_REQUIRES: "pytest"
CIBW_TEST_COMMAND: "pytest {package}/test"
CIBW_ARCHS_LINUX: auto aarch64
CIBW_ARCHS_MACOS: x86_64 universal2 arm64
CIBW_SKIP: pp*
- name: Upload Wheels
uses: actions/upload-artifact@v1
with:
name: Wheels
path: wheelhouse

View file

@ -1,99 +0,0 @@
name: Build and test windows wheels
on:
push:
pull_request:
create:
jobs:
build:
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Cythonize
shell: bash
run: |
pip install -U Cython
make cython
#python setup.py sdist
- name: Python 3.6 (amd64)
env:
PYTHON: "py -3.6-64"
shell: bash
run: |
ci/runtests.sh
- name: Python 3.6 (x86)
env:
PYTHON: "py -3.6-32"
shell: bash
run: |
ci/runtests.sh
- name: Python 3.7 (amd64)
env:
PYTHON: "py -3.7-64"
shell: bash
run: |
ci/runtests.sh
- name: Python 3.7 (x86)
env:
PYTHON: "py -3.7-32"
shell: bash
run: |
ci/runtests.sh
- name: Python 3.8 (amd64)
env:
PYTHON: "py -3.8-64"
shell: bash
run: |
ci/runtests.sh
- name: Python 3.8 (x86)
env:
PYTHON: "py -3.8-32"
shell: bash
run: |
ci/runtests.sh
- name: Python 3.9 (amd64)
env:
PYTHON: "py -3.9-64"
shell: bash
run: |
ci/runtests.sh
- name: Python 3.9 (x86)
env:
PYTHON: "py -3.9-32"
shell: bash
run: |
ci/runtests.sh
- name: Python 3.10 (amd64)
env:
PYTHON: "py -3.10-64"
shell: bash
run: |
ci/runtests.sh
- name: Python 3.10 (x86)
env:
PYTHON: "py -3.10-32"
shell: bash
run: |
ci/runtests.sh
- name: Upload Wheels
uses: actions/upload-artifact@v1
with:
name: win-wheels
path: ./dist

View file

@ -1,89 +0,0 @@
version: ~> 1.0
dist: xenial
language: python
cache: pip
arch:
- arm64
python:
# Available Python (PyPy) can be listed by:
#
# $ aws s3 ls s3://travis-python-archives/binaries/ubuntu/16.04/x86_64/
- "3.6"
- "3.7"
- "3.8"
- "3.9-dev"
_pure: &pure
install:
- pip install -U pip
- pip install -U pytest pytest-cov codecov
- pip install .
script:
- pytest --cov=msgpack -v test
matrix:
include:
- name: 32bit build
arch: amd64
language: python
services:
- docker
env:
- DOCKER_IMAGE=quay.io/pypa/manylinux1_i686
install:
- pip install -U pip
- pip install -r requirements.txt
- make cython
- docker pull $DOCKER_IMAGE
script:
- docker run --rm -v `pwd`:/io -w /io $DOCKER_IMAGE /io/docker/runtests.sh
- arch: arm64
name: arm64 32bit build
language: python
services:
- docker
env:
- DOCKER_IMAGE=quay.io/pypa/manylinux2014_aarch64
install:
- pip install -U pip
- pip install -r requirements.txt
- make cython
- docker pull $DOCKER_IMAGE
script:
- docker run --rm -v `pwd`:/io -w /io $DOCKER_IMAGE /io/docker/runtests.sh
- name: "Python 2 (fallback)"
python: "2.7"
<<: *pure
- name: "pypy2.7"
arch: amd64
python: "pypy2.7-7.1.1"
<<: *pure
- name: "pypy3"
arch: amd64
python: "pypy3.6-7.1.1"
<<: *pure
install:
- pip install -U pip
- pip install -U pytest pytest-cov codecov
- pip install -r requirements.txt # Cython
- make cython
- pip install -e .
script:
- python -c 'import sys; print(hex(sys.maxsize))'
- python -c 'from msgpack import _cmsgpack'
- pytest --cov=msgpack -v test
- MSGPACK_PUREPYTHON=x pytest --cov=msgpack -v test
after_success:
- if [ -f .coverage ]; then
codecov;
fi
# vim: sw=2 ts=2

View file

@ -31,8 +31,9 @@ clean:
.PHONY: update-docker .PHONY: update-docker
update-docker: update-docker:
docker pull quay.io/pypa/manylinux1_i686 docker pull quay.io/pypa/manylinux2014_i686
docker pull quay.io/pypa/manylinux1_x86_64 docker pull quay.io/pypa/manylinux2014_x86_64
docker pull quay.io/pypa/manylinux2014_aarch64
.PHONY: linux-wheel .PHONY: linux-wheel
linux-wheel: linux-wheel:

View file

@ -1,50 +0,0 @@
environment:
matrix:
# For Python versions available on Appveyor, see
# http://www.appveyor.com/docs/installed-software#python
- PYTHON: "C:\\Python36"
install:
# We need wheel installed to build wheels
- "%PYTHON%\\python.exe -m pip install -U pip"
- "%PYTHON%\\python.exe -m pip install -U cython"
- "%PYTHON%\\Scripts\\cython --cplus msgpack/_cmsgpack.pyx"
build: off
test_script:
# Put your test command here.
# Note that you must use the environment variable %PYTHON% to refer to
# the interpreter you're using - Appveyor does not do anything special
# to put the Python version you want to use on PATH.
- set PYTHON="C:\\Python27"
- ci\\runtests.bat
- set PYTHON="C:\\Python27-x64"
- ci\\runtests.bat
- set PYTHON="C:\\Python36"
- ci\\runtests.bat
- set PYTHON="C:\\Python36-x64"
- ci\\runtests.bat
- set PYTHON="C:\\Python37"
- ci\\runtests.bat
- set PYTHON="C:\\Python37-x64"
- ci\\runtests.bat
- set PYTHON="C:\\Python38"
- ci\\runtests.bat
- set PYTHON="C:\\Python38-x64"
- ci\\runtests.bat
after_test:
# This step builds your wheels.
# Again, you need to use %PYTHON% to get the correct interpreter
artifacts:
# bdist_wheel puts your built wheel in the dist directory
- path: dist\*.whl
#on_success:
# You can use this step to upload your artifacts to a public website.
# See Appveyor's documentation for more details. Or you can simply
# access your wheels from the Appveyor "artifacts" tab for your build.
# vim: set shiftwidth=2

View file

@ -1,9 +0,0 @@
%PYTHON%\python.exe -m pip install -U pip wheel pytest
%PYTHON%\python.exe setup.py build_ext -i
%PYTHON%\python.exe setup.py install
%PYTHON%\python.exe -c "import sys; print(hex(sys.maxsize))"
%PYTHON%\python.exe -c "from msgpack import _cmsgpack"
%PYTHON%\python.exe setup.py bdist_wheel
%PYTHON%\python.exe -m pytest -v test
SET EL=%ERRORLEVEL%
exit /b %EL%

View file

@ -1,8 +0,0 @@
#!/bin/bash
set -ex
${PYTHON} -VV
${PYTHON} -m pip install setuptools wheel pytest
${PYTHON} setup.py build_ext -if
${PYTHON} -c "from msgpack import _cmsgpack"
${PYTHON} setup.py bdist_wheel
${PYTHON} -m pytest -v test