Build wheel and publish #71
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: Build wheel and publish | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
env: | |
CIBW_BUILD: "cp39-* cp310-*" | |
CIBW_SKIP: "*-win32 *musllinux*" | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
CIBW_BEFORE_BUILD: pip install numpy --config-settings=setup-args="-Dallow-noblas=true" | |
CIBW_BUILD_VERBOSITY: "1" | |
CIBW_TEST_COMMAND: python src/cosmic/tests/test_evolve.py | |
jobs: | |
build-wheels-and-dist: | |
name: Build ${{ matrix.python-version }} wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: [3.9, "3.10"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: "3.10" | |
- name: Install gfortran | |
if: runner.os == 'macOS' | |
run: | | |
sudo ln -s /opt/homebrew/bin/gfortran-14 /usr/local/bin/gfortran | |
- name: Install numpy | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install numpy h5py versioneer | |
- name: Install dependencies | |
run: | | |
python -m pip install cibuildwheel==2.17.0 setuptools wheel twine numpy build meson ninja | |
- name: Build source distribution (sdist) | |
run: | | |
python -m build --sdist --outdir dist | |
- name: Build wheels using cibuildwheel | |
run: | | |
cibuildwheel --outdir dist | |
unzip -l ./dist/*.whl | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./dist/*.tar.gz | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./dist/*.whl | |
publish: | |
needs: [build-wheels-and-dist] | |
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.10"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Download builds | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.pypi_password }} |