Update __init__.py #194
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
# This is partially adopted from scipy. | |
# See: https://github.com/scipy/scipy/blob/main/.github/workflows/wheels.yml | |
# License: 3-clause BSD, https://github.com/scipy/scipy/blob/main/LICENSE.txt | |
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 wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }} ${{ matrix.buildplat[2] }} | |
runs-on: ${{ matrix.buildplat[0] }} | |
strategy: | |
matrix: | |
buildplat: | |
- [ubuntu-latest, manylinux, x86_64] | |
- [macos-12, macosx, x86_64] | |
- [windows-2019, win, AMD64] | |
- [macos-14, macosx, arm64] | |
python: ["cp38", "cp39", "cp310", "cp311", "cp312"] | |
exclude: | |
- buildplat: [macos-14, macosx, arm64] | |
python: "cp38" | |
fail-fast: false | |
env: | |
IS_32_BIT: ${{ matrix.buildplat[2] == 'x86' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}* | |
CIBW_ARCHS: ${{ matrix.buildplat[2] }} | |
CIBW_ENVIRONMENT_PASS_LINUX: RUNNER_OS | |
CIBW_TEST_REQUIRES: meson-python>=0.12.0 ninja | |
CIBW_BEFORE_ALL_MACOS: "brew install gfortran gnu-sed && brew unlink gfortran && brew link gfortran" | |
CIBW_TEST_COMMAND_MACOS: "cd {project}/examples; make clean_meson; make test_meson" | |
CIBW_TEST_COMMAND_LINUX: "cd {project}/examples; make clean_meson; make test_meson" | |
CIBW_TEST_COMMAND_WINDOWS: "python -m f90wrap --version" | |
- name: Setup tmate session | |
if: failure() | |
uses: mxschmitt/action-tmate@v3 | |
timeout-minutes: 15 | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: ./wheelhouse/*.whl | |
name: ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }} | |
- name: Release wheels | |
uses: softprops/action-gh-release@v2 | |
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 | |
shell: bash | |
- name: Deploy wheels 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 }} | |
shell: bash | |
- name: Deploy sdist to PyPI | |
if: ${{ steps.check-tag.outputs.match == 'true' && startsWith(matrix.buildplat[0], 'ubuntu') && matrix.python == 'cp311' }} | |
run: | | |
pip install build | |
python -m build | |
twine upload dist/f90wrap-*.tar.gz | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
shell: bash |