Skip to content

Fix identity decorator for when Numba unavailable (#220) #165

Fix identity decorator for when Numba unavailable (#220)

Fix identity decorator for when Numba unavailable (#220) #165

Workflow file for this run

## These options mostly follow the ones used in
## https://github.com/matplotlib/matplotlib/blob/main/.github/workflows/cibuildwheel.yml, though I
## try to be a little less complicated.
name: tests
on:
push:
branches:
- main
tags: '*'
pull_request:
jobs:
get_new_version:
name: Get new version number
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.10'
- name: Install tomli
shell: bash
run: |
python -m pip install --upgrade pip tomli
- name: Install poetry
shell: bash
run: |
curl -sSL https://install.python-poetry.org | POETRY_HOME="$HOME/.poetry" python -
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
- name: Bump version
id: get_version
shell: bash
env:
github_event_head_commit_message: ${{ github.event.head_commit.message }}
run: |
export version_bump_rule=$(python .github/scripts/parse_bump_rule.py)
echo "version_bump_rule: '${version_bump_rule}'"
poetry version "${version_bump_rule}"
export new_version=$(python .github/scripts/parse_version.py pyproject.toml)
echo "new_version: '${new_version}'"
echo "::set-output name=version::${new_version}"
build_wheels:
needs: get_new_version
name: Build wheels on ${{ matrix.os }} for ${{matrix.archs}}
runs-on: ${{ matrix.os }}
if: >-
!contains(github.event.head_commit.message, '[skip ci]')
&& !contains(github.event.head_commit.message, '[skip tests]')
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
archs: ["auto"]
include:
- os: ubuntu-latest
archs: "aarch64"
env:
CIBW_SKIP: cp27-* cp35-* cp36-* cp37-* pp* *-musllinux_aarch64
CIBW_ARCHS: ${{matrix.archs}}
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
CIBW_BEFORE_BUILD: python -c "print(('#'*130+'\n')*10)" && python -m pip install oldest-supported-numpy
CIBW_TEST_REQUIRES: pytest pytest-cov
CIBW_TEST_COMMAND: "pytest {project}/tests"
steps:
- name: Set up QEMU
if: matrix.archs == 'aarch64'
id: qemu
uses: docker/setup-qemu-action@v1
with:
platforms: arm64
- name: "Check out code"
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.8'
- name: Update versions
shell: bash
run: |
export new_version=${{needs.get_new_version.outputs.version}}
echo "Updating version to '${new_version}'"
python .github/scripts/update_versions.py
- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip
python -m pip install cibuildwheel
- name: Build wheels
run: |
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
build_sdist:
needs: get_new_version
name: Build source distribution
runs-on: ubuntu-latest
if: >-
!contains(github.event.head_commit.message, '[skip ci]')
&& !contains(github.event.head_commit.message, '[skip tests]')
steps:
- name: 'Check out code'
uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.8'
- name: Update versions
shell: bash
run: |
export new_version=${{needs.get_new_version.outputs.version}}
echo "Updating version to '${new_version}'"
python .github/scripts/update_versions.py
- name: Build sdist
run: |
python -m pip install oldest-supported-numpy
python setup.py sdist
- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
upload_pypi:
needs: [get_new_version, build_wheels, build_sdist]
name: Tag and release
runs-on: ubuntu-latest
if: >-
github.ref == 'refs/heads/main'
&& !contains(github.event.head_commit.message, '[no release]')
&& (success() || contains(github.event.head_commit.message, '[skip tests]'))
steps:
- name: Check out code
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.10'
- name: Update versions
shell: bash
run: |
export new_version=${{needs.get_new_version.outputs.version}}
echo "Updating version to '${new_version}'"
python .github/scripts/update_versions.py
- name: Tag and push new version
shell: bash
run: |
export new_version=${{needs.get_new_version.outputs.version}}
git config user.name github-actions
git config user.email [email protected]
git commit -m "Update version for new release" pyproject.toml setup.py src/quaternion/__init__.py
git tag -a "v${new_version}" -m "Version ${new_version}"
git status
git push --follow-tags # Will not trigger new workflow because it uses GITHUB_TOKEN
- name: Create release
if: "!contains(github.event.head_commit.message, '[no release]')"
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ needs.get_new_version.outputs.version }}
name: Release v${{ needs.get_new_version.outputs.version }}
draft: false
prerelease: false
- name: Send to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}