Skip to content

Commit

Permalink
Add build workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
pchanial committed Aug 24, 2022
1 parent 23ac3f2 commit a1acabc
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Build

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:

build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

build_wheels:
name: Build wheels (${{ matrix.python.version }}) on ${{ matrix.platform.os }}/${{ matrix.platform.arch }}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- os: ubuntu-20.04
arch: x86_64
- os: macos-11
arch: x86_64
- os: macos-11
arch: arm64
python:
- version: "3.8"
cp: cp38
- version: "3.9"
cp: cp39
- version: "3.10"
cp: cp310
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v4

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.python.cp }}-*
CIBW_SKIP: "*-musllinux_*"
CIBW_ARCHS: ${{ matrix.platform.arch }}
CIBW_BEFORE_TEST_LINUX: |
yum install -y openmpi-devel
MPICC=/lib64/openmpi/bin/mpicc pip install mpi4py
CIBW_BEFORE_TEST_MACOS: brew install openmpi
CIBW_TEST_EXTRAS: dev
CIBW_TEST_COMMAND: pytest {package}/tests

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

upload_all:
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_SECRET }}
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ dev = [
"pytest-cov",
"pytest-mock",
"pchanial-legacy-install-hooks",
"setuptools_scm",
]

[project.urls]
Expand Down

0 comments on commit a1acabc

Please sign in to comment.