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
steps:
- name: Setup Python
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: '3.x'
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