Skip to content

Wheels macos #379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/release_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build all wheels and release them

on:
release:
types: [published]

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-10.15
name: mac
cibw:
build: "cp36* cp37* cp38*"
- os: macos-10.15
name: mac-arm
cibw:
arch: universal2
build: "cp39*"
env:
CIBW_BUILD: "${{ matrix.cibw.build || '*' }}"
CIBW_ARCHS_MACOS: "${{ matrix.cibw.arch || 'auto' }}"
CIBW_BEFORE_BUILD_MACOS: "brew install libomp"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
# due to package and module name conflict have to temporarily move it away to run tests
CIBW_BEFORE_TEST_MACOS: "mv {package}/qsimcirq /tmp"
CIBW_TEST_COMMAND_MACOS: "pytest {package}/qsimcirq_tests/qsimcirq_test.py && mv /tmp/qsimcirq {package}"
steps:
- uses: actions/checkout@v2

# Used to host cibuildwheel
- uses: actions/setup-python@v2

- name: Install cibuildwheel and twine
run: python -m pip install cibuildwheel==1.11.0

- name: Run C++ tests
run: bash build_tools/test_libs.sh

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse

- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl

- name: Publish packaged wheels
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: wheelhouse/
skip_existing: true
verbose: true
55 changes: 55 additions & 0 deletions .github/workflows/testing_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build all wheels for testing

on:
push:
# Build wheels when pushing to master.
branches:
- master

# Build wheels for any PRs.
pull_request:

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-10.15
name: mac
cibw:
build: "cp36* cp37* cp38*"
- os: macos-10.15
name: mac-arm
cibw:
arch: universal2
build: "cp39*"
env:
CIBW_BUILD: "${{ matrix.cibw.build || '*' }}"
CIBW_ARCHS_MACOS: "${{ matrix.cibw.arch || 'auto' }}"
CIBW_BEFORE_BUILD_MACOS: "brew install libomp"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
# due to package and module name conflict have to temporarily move it away to run tests
CIBW_BEFORE_TEST_MACOS: "mv {package}/qsimcirq /tmp"
CIBW_TEST_COMMAND_MACOS: "pytest {package}/qsimcirq_tests/qsimcirq_test.py && mv /tmp/qsimcirq {package}"
steps:
- uses: actions/checkout@v2

# Used to host cibuildwheel
- uses: actions/setup-python@v2

- name: Install cibuildwheel and twine
run: python -m pip install cibuildwheel==1.11.0

- name: Run C++ tests
run: bash build_tools/test_libs.sh

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse

- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl

26 changes: 26 additions & 0 deletions build_tools/test_libs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -e # fail and exit on any command erroring
set -x # print evaluated commands

which bazel
bazel version

# Attempt to build all components in SSE and basic mode.
# The Github Action MacOS VMs may run on different-capability CPUs, so all AVX tests
# are excluded from the build and test process.

bazel build --config=sse apps:all
bazel build apps:all

# Run all basic tests.
set e # Ignore errors until artifacts are collected.
EXIT_CODE=0
for TARGET in bitstring_test channels_cirq_test circuit_qsim_parser_test expect_test \
fuser_basic_test gates_qsim_test hybrid_test matrix_test qtrajectory_test \
run_qsim_test run_qsimh_test simulator_basic_test simulator_sse_test statespace_basic_test \
statespace_sse_test unitary_calculator_basic_test unitary_calculator_sse_test \
unitaryspace_basic_test unitaryspace_sse_test vectorspace_test; do \
if ! bazel test --test_output=errors tests:${TARGET}; then
EXIT_CODE=1
fi
done