Build using numpy 2 #1155
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, test, and deploy, wheels | |
on: | |
schedule: | |
- cron: "0 0 1 * *" | |
release: | |
types: [created] | |
pull_request: | |
branches: [main, dev] | |
jobs: | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.12.1 | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Build sdist | |
shell: bash | |
run: | | |
python -m pip install --upgrade pip build | |
python -m build -s . | |
- name: Upload sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sdist | |
path: dist | |
macos-wheels: | |
name: Build and test macOS wheels | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
rust: [1.62.1] | |
os: [macos-14, macos-13] | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.12.1 | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Install cbindgen | |
uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: cbindgen | |
version: "=0.24.3" | |
locked: true | |
cache-key: ${{ matrix.os }} | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.19.1 | |
- name: Upload Wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}-wheels | |
path: wheelhouse | |
manylinux2_28: | |
name: Build and test Linux wheels | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.12.1 | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.19.1 | |
- name: Upload Wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-wheels | |
path: wheelhouse | |
manylinux2_28_test: | |
name: Build package from source dist | |
runs-on: ubuntu-latest | |
needs: ['build_sdist'] | |
strategy: | |
matrix: | |
python: [3.9, "3.10", "3.11", "3.12"] | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.12.1 | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download sdist | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: sdist | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install sdist into venv | |
run: | | |
python -m venv sdist_venv | |
source sdist_venv/bin/activate | |
python -m pip install --upgrade pip setuptools | |
python -m pip install *.gz | |
# The cd is to move us away from | |
# the project repo root where the module is not built | |
cd sdist_venv | |
python -c "import fwdpy11;print(fwdpy11.__version__)" | |
deactivate | |
rm -rf sdist_venv | |
# Test that wheels build in the docker cibuildwheel workflow | |
# can be installed on Ubuntu Linux, which is a different distro. | |
manylinux2_28_test_install_wheel: | |
name: Install the wheel on github runner | |
runs-on: ubuntu-latest | |
needs: ['manylinux2_28'] | |
strategy: | |
matrix: | |
python: [3.8, 3.9, "3.10", "3.11", "3.12"] | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.12.1 | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download sdist | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: linux-wheels | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: install into venv | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
python -m pip install --no-cache-dir --only-binary=fwdpy11 --pre --find-links . fwdpy11 | |
python -m fwdpy11 --includes | |
python -c "import fwdpy11;print(fwdpy11.__version__)" | |
python -c "import fwdpy11;print(fwdpy11.__file__)" | |
macos_test_install_wheel: | |
name: Install the wheel on github runner | |
runs-on: ${{ matrix.os }} | |
needs: ['macos-wheels'] | |
strategy: | |
matrix: | |
python: ["3.11", "3.12"] | |
os: [macos-14, macos-13] | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.12.1 | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download sdist | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: ${{ matrix.os }}-wheels | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: install into venv | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
python -m pip install --no-cache-dir --only-binary=fwdpy11 --pre --find-links . fwdpy11 | |
python -m fwdpy11 --includes | |
python -c "import fwdpy11;print(fwdpy11.__version__)" | |
python -c "import fwdpy11;print(fwdpy11.__file__)" | |
upload_to_PyPI: | |
name: Upload to PyPI | |
runs-on: ubuntu-latest | |
needs: ['manylinux2_28', 'manylinux2_28_test', 'manylinux2_28_test_install_wheel', 'macos_test_install_wheel'] | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.12.1 | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download all | |
uses: actions/download-artifact@v4.1.7 | |
- name: Move to dist | |
run: | | |
mkdir dist | |
cp */*.{whl,gz} dist/. | |
- name: Publish distribution to PRODUCTION PyPI | |
if: github.event_name == 'release' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_UPLOAD }} |