Skip to content

Commit

Permalink
Update GHA workflows (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrnr authored Jul 18, 2024
1 parent 056a935 commit feea895
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 46 deletions.
33 changes: 9 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ name: Release
on:
release:
types: [published]
workflow_dispatch:
# allow manual runs on branches without a PR


jobs:
pre-commit:
name: Pre-commit checks
style:
name: Check style
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand All @@ -18,61 +15,49 @@ jobs:
python-version: '3.12'
- uses: pre-commit/action@v3.0.1


build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

needs: style
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macos-14]

name: Build wheels (${{ matrix.os }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Build wheels
- name: Build wheels and run tests
uses: pypa/cibuildwheel@v2.19.2

- uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.os }}
path: ./wheelhouse/*.whl


build_sdist:
needs: style
name: Build source distribution
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
name: Install Python
with:
python-version: 3.12

- name: Build sdist
run: |
python -m pip install build numpy
python -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: artifact-sdist
path: dist/*.tar.gz


upload_pypi:
upload-pypi:
name: Upload to PyPI
needs: [pre-commit, build_wheels, build_sdist]
needs: [style, build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: artifact-*
merge-multiple: true
path: dist

- uses: pypa/gh-action-pypi-publish@v1.9.0
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
29 changes: 7 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
name: Test

on:
push:
branches:
- main
pull_request:
paths-ignore:
- 'doc/**'
workflow_dispatch:
# allow manual runs on branches without a PR

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

- 'docs/**'

jobs:
pre-commit:
name: Pre-commit checks
style:
name: Check style
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand All @@ -26,22 +16,17 @@ jobs:
python-version: '3.12'
- uses: pre-commit/action@v3.0.1


test:
needs: [pre-commit]
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

needs: style
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macos-14]

name: Run tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Build wheels and run pytest
- name: Build wheels and run tests
uses: pypa/cibuildwheel@v2.19.2

- uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.os }}
Expand Down

0 comments on commit feea895

Please sign in to comment.