Cross-compile gfortran #102
Workflow file for this run
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
name: python | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
build_wheels: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64 | |
- os: macos-latest | |
target: x86_64 | |
- os: macos-latest | |
target: aarch64 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: symlink gfortran (macOS) | |
if: (runner.os == 'macOS') && (matrix.target == 'aarch64') | |
run: | | |
brew fetch --force --bottle-tag=arm64_big_sur gcc@12 | |
brew install $(brew --cache --bottle-tag=arm64_sonoma gcc@12) | |
ln -s /usr/local/bin/gfortran-12 /usr/local/bin/gfortran | |
gfortran --version | |
- name: symlink gfortran (macOS) | |
if: (runner.os == 'macOS') && (matrix.target == 'x86_64') | |
run: | | |
ln -s /usr/local/bin/gfortran-12 /usr/local/bin/gfortran | |
gfortran --version | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
architecture: x64 | |
- name: build wheel | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist | |
manylinux: auto | |
sccache: true | |
- name: delocate wheel (macOS) | |
if: runner.os == 'macOS' | |
run: | | |
pip install delocate | |
delocate-wheel --require-archs ${{ matrix.target }} -v dist/*.whl | |
- name: install built wheel | |
if: ${{ matrix.target == 'x86_64' }} | |
run: | | |
pip install optik --no-index --find-links dist | |
python -c "import optik" | |
- name: upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: build sdist | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: sdist | |
args: --out dist --manifest-path crates/optik-py/Cargo.toml | |
- name: upload sdist | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
prerelease: | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
concurrency: | |
group: push-${{ github.ref_name }}-prerelease | |
cancel-in-progress: true | |
needs: [build_wheels, sdist] | |
steps: | |
- uses: dev-drprasad/[email protected] | |
with: | |
tag_name: prerelease | |
delete_release: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
path: wheels | |
- name: GitHub release | |
uses: ncipollo/[email protected] | |
with: | |
prerelease: true | |
tag: "prerelease" | |
name: "Development Build" | |
allowUpdates: true | |
removeArtifacts: true | |
replacesArtifacts: true | |
artifacts: "wheels/*" | |
public: | |
name: publish to PyPI | |
runs-on: ubuntu-latest | |
if: "startsWith(github.ref, 'refs/tags/')" | |
needs: [build_wheels, sdist] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
- uses: PyO3/maturin-action@v1 | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
MATURIN_REPOSITORY: testpypi | |
with: | |
command: upload | |
args: --non-interactive --skip-existing * |