Skip to content

Commit fbaab71

Browse files
committed
ci: use cibuildwheel
1 parent aea3db2 commit fbaab71

File tree

6 files changed

+169
-392
lines changed

6 files changed

+169
-392
lines changed

.circleci/config.yml

Lines changed: 0 additions & 124 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
name: Build and upload to PyPI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
flake8:
9+
name: flake8
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- uses: actions/checkout@v2
13+
- run: pipx run flake8
14+
15+
build_wheels:
16+
name: Build ${{ matrix.build }} wheels on ${{ matrix.os }}
17+
needs: [flake8]
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- os: ubuntu-20.04
24+
build: "cp39-*x86_64*"
25+
- os: ubuntu-20.04
26+
build: "cp39-*i686*"
27+
- os: windows-2019
28+
build: "cp39-*win_amd64*"
29+
- os: windows-2019
30+
build: "cp39-*win32*"
31+
- os: macos-10.15
32+
build: "cp39-*x86_64*"
33+
34+
steps:
35+
- uses: actions/checkout@v2
36+
with:
37+
fetch-depth: 0 # required for versioneer to find tags
38+
39+
- name: Build wheels
40+
uses: pypa/[email protected]
41+
env:
42+
CIBW_BEFORE_ALL: "pipx install cmake && pipx install ninja"
43+
CIBW_BUILD: "${{ matrix.build }}"
44+
CIBW_ENVIRONMENT_MACOS: "MACOSX_DEPLOYMENT_TARGET=10.9"
45+
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux1_x86_64:2021-05-16-740a2ec
46+
CIBW_MANYLINUX_I686_IMAGE: quay.io/pypa/manylinux1_i686:2021-05-16-740a2ec
47+
CIBW_BEFORE_BUILD: "pip install -r requirements-repair.txt"
48+
CIBW_REPAIR_WHEEL_COMMAND: "python scripts/repair_wheel.py -w {dest_dir} {wheel}"
49+
CIBW_TEST_REQUIRES: "-r requirements-test.txt"
50+
CIBW_TEST_COMMAND: "pytest {project}/tests"
51+
52+
- uses: actions/upload-artifact@v2
53+
with:
54+
path: ./wheelhouse/*.whl
55+
56+
build_sdist:
57+
name: Build source distribution
58+
needs: [flake8]
59+
runs-on: ubuntu-20.04
60+
steps:
61+
- uses: actions/checkout@v2
62+
with:
63+
fetch-depth: 0 # required for versioneer to find tags
64+
65+
- name: Build SDist
66+
run: pipx run build --sdist
67+
68+
- uses: actions/upload-artifact@v2
69+
with:
70+
path: dist/*.tar.gz
71+
72+
test_sdist:
73+
name: Test SDist with python ${{ matrix.python }}
74+
needs: [build_sdist]
75+
runs-on: ubuntu-20.04
76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
python: ["2.7", "3.6", "3.10-dev"]
80+
81+
steps:
82+
- uses: actions/checkout@v2
83+
- uses: actions/setup-python@v2
84+
name: Install Python ${{ matrix.python }}
85+
with:
86+
python-version: ${{ matrix.python }}
87+
88+
- uses: actions/download-artifact@v2
89+
with:
90+
name: artifact
91+
path: dist
92+
93+
- name: Install SDist
94+
env:
95+
SKBUILD_CONFIGURE_OPTIONS: "-DBUILD_CMAKE_FROM_SOURCE:BOOL=OFF"
96+
run: pip install dist/*.tar.gz
97+
98+
- name: Install test dependencies
99+
run: pip install -r requirements-test.txt
100+
101+
- name: Test installed SDist
102+
run: pytest ./tests
103+
104+
check_dist:
105+
name: Check dist
106+
needs: [build_wheels, build_sdist, test_sdist]
107+
runs-on: ubuntu-20.04
108+
steps:
109+
- uses: actions/download-artifact@v2
110+
with:
111+
name: artifact
112+
path: dist
113+
114+
- run: |
115+
pipx install twine
116+
twine check --strict dist/*
117+
118+
upload_pypi:
119+
name: Upload to (Test) PyPI
120+
needs: [build_wheels, build_sdist, test_sdist, check_dist]
121+
runs-on: ubuntu-latest
122+
if: github.event_name == 'push' && github.repository == 'scikit-build/ninja-python-distributions'
123+
steps:
124+
- uses: actions/download-artifact@v2
125+
with:
126+
name: artifact
127+
path: dist
128+
129+
- name: Upload to Test PyPI
130+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
131+
with:
132+
user: __token__
133+
password: ${{ secrets.PYPI_TEST_PASSWORD }}
134+
skip_existing: true
135+
repository_url: https://test.pypi.org/legacy/
136+
137+
- name: Upload to PyPI
138+
# upload to PyPI on every tag
139+
if: startsWith(github.ref, 'refs/tags/')
140+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
141+
with:
142+
user: __token__
143+
password: ${{ secrets.PYPI_RELEASE_PASSWORD }}
144+
skip_existing: true

0 commit comments

Comments
 (0)