Skip to content

Commit 9222a52

Browse files
authored
Re-add build of binary wheels (#425)
- For now without automatic upload of binaries to PyPi
1 parent b0c2607 commit 9222a52

File tree

3 files changed

+56
-17
lines changed

3 files changed

+56
-17
lines changed

.github/workflows/publish_release.yml

Lines changed: 53 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,18 @@ jobs:
1818
if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || github.event_name == 'workflow_dispatch'
1919
strategy:
2020
matrix:
21-
os:
22-
- ubuntu-latest
23-
21+
cibw_archs: ["auto64"]
22+
os: [ubuntu-latest, windows-latest, macos-latest]
23+
# include:
24+
# - os: ubuntu-18.04
25+
# cibw_archs: "aarch64"
2426
steps:
27+
- name: Set up QEMU
28+
if: matrix.cibw_archs == 'aarch64'
29+
uses: docker/setup-qemu-action@v1
30+
with:
31+
platforms: arm64
32+
2533
- uses: actions/checkout@v2
2634
if: github.event_name != 'workflow_dispatch'
2735

@@ -73,21 +81,53 @@ jobs:
7381
- uses: actions/setup-python@v2
7482

7583
- name: Install Python packages
76-
run: python3 -m pip install -U pip setuptools build wheel
84+
run: python -m pip install -U --prefer-binary pip setuptools build wheel twine 'cibuildwheel<3,>=2'
7785

7886
- name: Build source distribution (Linux)
7987
if: runner.os == 'Linux'
80-
run: python3 -m build --sdist
88+
id: src-dist
89+
run: |
90+
python -m build --sdist
91+
python -m twine check dist/*
8192
82-
- name: Check metadata
93+
- name: Build binary wheels
94+
continue-on-error: true
95+
id: binary-dist
8396
run: |
84-
python3 -m pip install twine --prefer-binary
85-
python3 -m twine check dist/*
97+
python -m cibuildwheel --output-dir binary_dist
98+
python -m twine check binary_dist/*
99+
env:
100+
CIBW_ARCHS: ${{ matrix.cibw_archs }}
101+
102+
- name: Build binary wheels without (failing) testing
103+
if: steps.binary-dist.outcome == 'failure'
104+
id: failed-dist
105+
run: |
106+
python -m cibuildwheel --output-dir failed_dist
107+
env:
108+
CIBW_ARCHS: ${{ matrix.cibw_archs }}
109+
CIBW_TEST_SKIP: '*'
86110

87-
- uses: actions/upload-artifact@v2
111+
- name: Files for Pypi upload
112+
uses: actions/upload-artifact@v2
113+
if: steps.src-dist.outcome == 'success'
88114
with:
89115
name: pypy_wheels
90-
path: ./dist/*
116+
path: ./dist
117+
118+
- name: Binary wheels
119+
uses: actions/upload-artifact@v2
120+
if: steps.binary-dist.outcome == 'success'
121+
with:
122+
name: wheels
123+
path: ./binary_dist
124+
125+
- name: Binary wheels that failed tests
126+
uses: actions/upload-artifact@v2
127+
if: steps.failed-dist.outcome == 'success'
128+
with:
129+
name: failed_wheels
130+
path: ./failed_dist
91131

92132

93133
release:
@@ -142,8 +182,6 @@ jobs:
142182
# ------------------------------------------------------------------------
143183

144184
- uses: actions/download-artifact@v2
145-
with:
146-
name: pypy_wheels
147185

148186
# Code below inspired from this action:
149187
# - uses: taiki-e/create-gh-release-action@v1
@@ -168,7 +206,9 @@ jobs:
168206
if [[ "${tag}" =~ ^v?[0-9\.]+-[a-zA-Z_0-9\.-]+(\+[a-zA-Z_0-9\.-]+)?$ ]]; then
169207
prerelease="--prerelease"
170208
fi
171-
gh release create "v${RELEASE_VERSION}" ${prerelease:-} --title "ProjectQ v${RELEASE_VERSION}" --notes "${notes:-}" pypy_wheels/*
209+
210+
mkdir -p wheels pypy_wheels
211+
gh release create "v${RELEASE_VERSION}" ${prerelease:-} --title "ProjectQ v${RELEASE_VERSION}" --notes "${notes:-}" pypy_wheels/* wheels/*
172212
173213
174214
upload_to_pypi:
@@ -179,8 +219,6 @@ jobs:
179219
- uses: actions/setup-python@v2
180220

181221
- uses: actions/download-artifact@v2
182-
with:
183-
name: pypy_wheels
184222

185223
- name: Publish standard package
186224
uses: pypa/gh-action-pypi-publish@release/v1

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2626

2727
- Add configuration for CIBuildWheel in `pyproject.toml`
2828
- Remove use of deprecated images `windows-2016` in GitHub workflows
29+
- Re-add build of Python binary wheels in release publishing GitHub workflow
2930
- Update `dangoslen/changelog-enforcer` GitHub action to v3
3031
- Update `thomaseizinger/keep-a-changelog-new-release` GiHub action to v1.3.0
3132
- Update `thomaseizinger/create-pull-request` GiHub action to v1.2.2

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ archs = ['auto64']
120120
build-frontend = 'build'
121121
build-verbosity = 1
122122
skip = 'pp* *-musllinux*'
123-
environment = { PROJECTQ_DISABLE_ARCH_NATIVE='1', PROJECTQ_CI_BUILD='1' }
123+
environment = { PROJECTQ_DISABLE_ARCH_NATIVE='1', PROJECTQ_CI_BUILD='1', OMP_NUM_THREADS='1' }
124124

125125
before-test = [
126126
'cd {package}',
127127
'python setup.py gen_reqfile',
128128
'python -m pip install -r requirements.txt --only-binary :all:',
129129
]
130130

131-
test-command = 'python3 {package}/examples/grover.py'
131+
test-command = 'python {package}/examples/grover.py'
132132

133133
# Normal options, etc.
134134
manylinux-x86_64-image = 'manylinux2014'

0 commit comments

Comments
 (0)