Skip to content

use macos-15 runner #22

use macos-15 runner

use macos-15 runner #22

Workflow file for this run

name: Build and upload to PyPI
on:
# uncomment pr trigger when testing
# pull_request:
# branches:
# - "main"
push:
tags:
- "*"
release:
types:
- published
concurrency:
group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}"
cancel-in-progress: true
defaults:
run:
shell: bash -l {0}
jobs:
build_wheels:
if: "github.repository == 'MDAnalysis/mdaencore'"
name: Build wheels
runs-on: ${{ matrix.buildplat[0] }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
buildplat:
- [ubuntu-22.04, manylinux_x86_64, x86_64]
- [windows-2022, win_amd64, AMD64]
- [macos-15, macosx_*, arm64]
python: ["cp311", "cp312", "cp313", "cp314"]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Build wheels
uses: pypa/cibuildwheel@v3.4.0
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
CIBW_ARCHS: ${{ matrix.buildplat[2] }}
CIBW_BUILD_VERBOSITY: 1
- name: upload artifacts
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'release' && github.event.action == 'published')
uses: actions/upload-artifact@v7
with:
name: wheel-${{ matrix.buildplat[0] }}-${{ matrix.python }}
path: wheelhouse/*.whl
retention-days: 7
build_sdist:
if: "github.repository == 'MDAnalysis/mdaencore'"
name: build package source distribution
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
version: ${{ steps.extract-version.outputs.version }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Build sdist
run: pipx run build --sdist
- name: Extract package version
id: extract-version
run: |
SDIST_FILE=$(ls dist/*.tar.gz)
# Extract version from sdist archive (format: mdaencore-1.0.1rc1.tar.gz)
VERSION=$(tar xf ${SDIST_FILE} -O --wildcards '*/*.egg-info/PKG-INFO' | awk '/^Version:/ {print $2}')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Extracted version: $VERSION"
- name: upload artifacts
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'release' && github.event.action == 'published')
uses: actions/upload-artifact@v7
with:
name: dist-files
path: dist/*.tar.gz
retention-days: 7
upload_testpypi:
if: |
github.repository == 'MDAnalysis/mdaencore' &&
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
name: testpypi upload
environment:
name: deploy
url: https://test.pypi.org/p/mdaencore
permissions:
id-token: write
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist]
steps:
- uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: upload_source_and_wheels
uses: pypa/gh-action-pypi-publish@v1.14.0
with:
skip-existing: true
repository-url: https://test.pypi.org/legacy/
upload_pypi:
if: |
github.repository == 'MDAnalysis/mdaencore' &&
github.event_name == 'release' && github.event.action == 'published'
name: pypi upload
environment:
name: deploy
url: https://pypi.org/p/mdaencore
permissions:
id-token: write
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist]
steps:
- uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: upload_source_and_wheels
uses: pypa/gh-action-pypi-publish@v1.14.0
check_testpypi:
if: |
github.repository == 'MDAnalysis/mdaencore' &&
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
name: testpypi check
runs-on: ${{ matrix.os }}
timeout-minutes: 60
needs: [upload_testpypi, build_sdist]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- name: setup python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Wait for version to be available on TestPyPI (30 seconds)
run: sleep 30
- name: pip install mdaencore from testpypi (${{ needs.build_sdist.outputs.version }})
run: |
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple "mdaencore==${{ needs.build_sdist.outputs.version }}"
- name: install test deps
run: |
pip install pytest scikit-learn MDAnalysisTests
- name: run_tests
run: |
pytest -v --pyargs mdaencore