Skip to content

Commit

Permalink
Re-add build of binary wheels (#425)
Browse files Browse the repository at this point in the history
- For now without automatic upload of binaries to PyPi
  • Loading branch information
Takishima authored Jan 10, 2022
1 parent b0c2607 commit 9222a52
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 17 deletions.
68 changes: 53 additions & 15 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,18 @@ jobs:
if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || github.event_name == 'workflow_dispatch'
strategy:
matrix:
os:
- ubuntu-latest

cibw_archs: ["auto64"]
os: [ubuntu-latest, windows-latest, macos-latest]
# include:
# - os: ubuntu-18.04
# cibw_archs: "aarch64"
steps:
- name: Set up QEMU
if: matrix.cibw_archs == 'aarch64'
uses: docker/setup-qemu-action@v1
with:
platforms: arm64

- uses: actions/checkout@v2
if: github.event_name != 'workflow_dispatch'

Expand Down Expand Up @@ -73,21 +81,53 @@ jobs:
- uses: actions/setup-python@v2

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

- name: Build source distribution (Linux)
if: runner.os == 'Linux'
run: python3 -m build --sdist
id: src-dist
run: |
python -m build --sdist
python -m twine check dist/*
- name: Check metadata
- name: Build binary wheels
continue-on-error: true
id: binary-dist
run: |
python3 -m pip install twine --prefer-binary
python3 -m twine check dist/*
python -m cibuildwheel --output-dir binary_dist
python -m twine check binary_dist/*
env:
CIBW_ARCHS: ${{ matrix.cibw_archs }}

- name: Build binary wheels without (failing) testing
if: steps.binary-dist.outcome == 'failure'
id: failed-dist
run: |
python -m cibuildwheel --output-dir failed_dist
env:
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_TEST_SKIP: '*'

- uses: actions/upload-artifact@v2
- name: Files for Pypi upload
uses: actions/upload-artifact@v2
if: steps.src-dist.outcome == 'success'
with:
name: pypy_wheels
path: ./dist/*
path: ./dist

- name: Binary wheels
uses: actions/upload-artifact@v2
if: steps.binary-dist.outcome == 'success'
with:
name: wheels
path: ./binary_dist

- name: Binary wheels that failed tests
uses: actions/upload-artifact@v2
if: steps.failed-dist.outcome == 'success'
with:
name: failed_wheels
path: ./failed_dist


release:
Expand Down Expand Up @@ -142,8 +182,6 @@ jobs:
# ------------------------------------------------------------------------

- uses: actions/download-artifact@v2
with:
name: pypy_wheels

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

- uses: actions/download-artifact@v2
with:
name: pypy_wheels

- name: Publish standard package
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Add configuration for CIBuildWheel in `pyproject.toml`
- Remove use of deprecated images `windows-2016` in GitHub workflows
- Re-add build of Python binary wheels in release publishing GitHub workflow
- Update `dangoslen/changelog-enforcer` GitHub action to v3
- Update `thomaseizinger/keep-a-changelog-new-release` GiHub action to v1.3.0
- Update `thomaseizinger/create-pull-request` GiHub action to v1.2.2
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ archs = ['auto64']
build-frontend = 'build'
build-verbosity = 1
skip = 'pp* *-musllinux*'
environment = { PROJECTQ_DISABLE_ARCH_NATIVE='1', PROJECTQ_CI_BUILD='1' }
environment = { PROJECTQ_DISABLE_ARCH_NATIVE='1', PROJECTQ_CI_BUILD='1', OMP_NUM_THREADS='1' }

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

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

# Normal options, etc.
manylinux-x86_64-image = 'manylinux2014'
Expand Down

0 comments on commit 9222a52

Please sign in to comment.