-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from libAtoms/build-wheels
WIP Build wheels
- Loading branch information
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Build wheels | ||
|
||
# Controls when the action will run. | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the master branch | ||
push: | ||
branches: [ master ] | ||
tags: | ||
- v* | ||
pull_request: | ||
branches: [ master ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: ilammy/msvc-dev-cmd@v1 | ||
|
||
- uses: actions/setup-python@v2 | ||
|
||
- name: Install cibuildwheel | ||
run: python -m pip install cibuildwheel==2.9.0 | ||
|
||
- name: Build wheels | ||
run: | | ||
python -m cibuildwheel --output-dir wheelhouse | ||
env: | ||
CIBW_SKIP: cp27-* cp35-* cp36-* cp311-* pp* | ||
CIBW_ARCHS_MACOS: "x86_64 arm64" | ||
CIBW_BEFORE_BUILD: "pip install oldest-supported-numpy" | ||
CIBW_TEST_COMMAND: "cd {project}/tests; pip install -r ../requirements.txt; pytest" | ||
CIBW_TEST_SKIP: "*" | ||
|
||
# Uncomment to get SSH access for testing | ||
# - name: Setup tmate session | ||
# if: failure() | ||
# uses: mxschmitt/action-tmate@v3 | ||
# timeout-minutes: 15 | ||
|
||
- uses: actions/upload-artifact@v2 | ||
with: | ||
path: ./wheelhouse/*.whl | ||
|
||
- name: Release wheels | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: wheelhouse/*.whl | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Check tag | ||
id: check-tag | ||
run: | | ||
if [[ ${{ github.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
echo ::set-output name=match::true | ||
fi | ||
- name: Deploy to PyPI | ||
if: steps.check-tag.outputs.match == 'true' | ||
run: | | ||
pip install twine | ||
twine upload wheelhouse/*.whl | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |