Skip to content

Commit

Permalink
Update github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jkanche committed Dec 9, 2024
1 parent fad0246 commit 1ab2fec
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 50 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: 3.12
cache: 'pip'

- name: Install Python dependencies
Expand All @@ -34,7 +32,8 @@ jobs:
touch ./docs/_build/html/.nojekyll
- name: GH Pages Deployment
uses: JamesIves/[email protected]
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: ./docs/_build/html
Expand Down
52 changes: 30 additions & 22 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
tags:
- "*"
pull_request:

jobs:
build_linux_x86_64:
Expand All @@ -14,21 +15,25 @@ jobs:
uses: actions/checkout@v4

- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
uses: pypa/cibuildwheel@v2.22.0
env:
CIBW_ARCHS: x86_64
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
CIBW_MANYLINUX_X86_64_IMAGE: ghcr.io/artifactdb/prebuilt-hdf5/manylinux_x86_64:0.0.4
CIBW_MUSLLINUX_X86_64_IMAGE: ghcr.io/artifactdb/prebuilt-hdf5/musllinux_x86_64:0.0.4
CIBW_SKIP: pp*

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-linux-x86_64
path: ./wheelhouse/*.whl

build_macosx_x86_64:
name: Build wheels for macosx x86_64
runs-on: macos-13
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, macos-14]
steps:
- name: Check out repository
uses: actions/checkout@v4
Expand All @@ -39,7 +44,7 @@ jobs:
tar -xvf bundle.tar.gz
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
uses: pypa/cibuildwheel@v2.22.0
env:
CIBW_ARCHS: x86_64
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
Expand All @@ -48,13 +53,17 @@ jobs:
CIBW_SKIP: pp*
MACOSX_DEPLOYMENT_TARGET: 11.7

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}-x84_64
path: ./wheelhouse/*.whl

build_macosx_arm64:
name: Build wheels for macosx arm64
runs-on: macos-13
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, macos-14]
steps:
- name: Check out repository
uses: actions/checkout@v4
Expand All @@ -65,16 +74,17 @@ jobs:
tar -xvf bundle.tar.gz
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
uses: pypa/cibuildwheel@v2.22.0
env:
CIBW_ARCHS: arm64
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
CIBW_ENVIRONMENT: "MORE_CMAKE_OPTIONS=\"-DCMAKE_INSTALL_PREFIX=$(pwd)/installed -DCMAKE_OSX_ARCHITECTURES=arm64\""
CIBW_BUILD_VERBOSITY: 3
MACOSX_DEPLOYMENT_TARGET: 13.0

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}-arm64
path: ./wheelhouse/*.whl

# build_windows_x86_64:
Expand All @@ -97,7 +107,7 @@ jobs:
# shell: powershell
#
# - name: Build wheels
# uses: pypa/cibuildwheel@v2.16.2
# uses: pypa/cibuildwheel@v2.22.0
# env:
# CIBW_ARCHS: AMD64
# CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
Expand All @@ -108,23 +118,22 @@ jobs:
# CIBW_TEST_COMMAND: "pytest {package}/tests"
# CIBW_BUILD_VERBOSITY: 3

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

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true

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

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

upload_pypi:
Expand All @@ -133,14 +142,13 @@ jobs:
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
pattern: cibw-*
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@v1.8.3
- uses: pypa/gh-action-pypi-publish@v1.12.2
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
29 changes: 6 additions & 23 deletions .github/workflows/pypi-test.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
name: Run unit tests
name: Test the library

on:
push:
branches: [ master ]
branches:
- master
pull_request:
branches: [ master ]

jobs:
test:

runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -20,32 +19,16 @@ jobs:
with:
submodules: true

- name: Set up Python ${{ matrix.python-version }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools
DEPENDENCIES=$(python -c 'from setuptools.config.setupcfg import read_configuration as c; a = c("setup.cfg"); print(" ".join(a["options"]["install_requires"][1:] + a["options"]["extras_require"]["testing"][1:]))')
pip install ${DEPENDENCIES} pybind11
- name: Get latest CMake
uses: lukka/get-cmake@latest

# We do proper tests if we're on the master branch, or if we're creating a new release.
- name: Test with tox
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
run: |
pip install tox
tox
# Otherwise we do some cached builds and tests for faster merging of PRs.
- name: Set up ccache
if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags')
uses: hendrikmuhs/[email protected]

- name: Quickly build and test
if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags')
run: |
CC="ccache gcc" python setup.py install
pytest

0 comments on commit 1ab2fec

Please sign in to comment.