Skip to content

GH Branches Automated Mirroring (#459) #216

GH Branches Automated Mirroring (#459)

GH Branches Automated Mirroring (#459) #216

Workflow file for this run

name: build
# Build on every branch push, tag push, and pull request change:
#on: [push] #, pull_request]
# Alternatively, to publish when a (published) GitHub Release is created, use the following:
on:
push:
branches:
- 'westpa2'
- 'develop'
tags:
- 'v*'
pull_request:
branches:
- 'westpa2'
release:
types:
- published
jobs:
build_wheels:
name: Build py3.${{ matrix.python-version }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "macos-13", "macos-latest"] # macos-13 is x86_64, macos-latest is arm64
python-version: [9, 10, 11, 12] # sub-versions of Python
steps:
- uses: actions/checkout@v4
- name: "Install HDF5 with brew"
if: ${{ matrix.os == 'macos-latest' }}
run: "brew install hdf5"
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_SKIP: "pp* *-musllinux*"
CIBW_BUILD: "cp3${{ matrix.python-version }}-*"
CIBW_ARCHS_MACOS: "auto64" # x86_64 and arm64, depending on the os
CIBW_ARCHS_LINUX: "auto64" # x86_64 only
CIBW_DEPENDENCY_VERSIONS: "latest"
CIBW_TEST_COMMAND: >
python -c "import westpa; print(westpa.__version__)" &&
python -c "import westpa.core.propagators" &&
python -c "import westpa.core.binning" &&
python -c "import westpa.core.kinetics" &&
python -c "import westpa.core.reweight" &&
python -c "import westpa.work_managers" &&
python -c "import westpa.tools" &&
python -c "import westpa.fasthist" &&
python -c "import westpa.mclib" &&
echo "All done with the import tests!"
# Currently blocked by https://github.com/westpa/westpa/issues/70
#python -c "import westpa.trajtree"
with:
package-dir: .
output-dir: wheelhouse
config-file: "{package}/pyproject.toml"
- uses: actions/upload-artifact@v4
with:
name: artifact-wheels-${{ matrix.os }}-${{ matrix.python-version }}
path: ./wheelhouse/*.whl
overwrite: true
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build sdist
run: pipx run build --sdist
- name: Install from sdist and import
run: |
python -m pip install dist/*.tar.gz &&
python -c "import westpa; print(westpa.__version__)" &&
python -c "import westpa.core.propagators" &&
python -c "import westpa.core.binning" &&
python -c "import westpa.core.kinetics" &&
python -c "import westpa.core.reweight" &&
python -c "import westpa.work_managers" &&
python -c "import westpa.tools" &&
python -c "import westpa.fasthist" &&
python -c "import westpa.mclib" &&
echo "All done with the import tests!"
# Currently blocked by https://github.com/westpa/westpa/issues/70
# python -c "import westpa.trajtree"
- uses: actions/upload-artifact@v4
with:
name: artifact-sdist
path: dist/*.tar.gz
overwrite: true
upload_testpypi:
name: test.pypi
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment:
name: test.pypi
url: https://test.pypi.org/p/westpa
permissions:
id-token: write
# upload to test.PyPI on every tag starting with 'v'; only in westpa/westpa repository
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
if: |
github.repository == 'westpa/westpa' &&
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
steps:
- uses: actions/download-artifact@v4
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
pattern: artifact-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://test.pypi.org/legacy/
upload_pypi:
name: PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/westpa
permissions:
id-token: write
# upload to PyPI on every tag starting with 'v'
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
if: |
github.repository == 'westpa/westpa' &&
(github.event_name == 'release' && github.event.action == 'published')
steps:
- uses: actions/download-artifact@v4
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
pattern: artifact-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
# To test:
#repository_url: https://test.pypi.org/legacy/
update-tags:
name: Update develop branch tags
needs: [upload_pypi]
runs-on: ubuntu-latest
# Assuming that since it has sucessfully uploaded to PyPI, this release is safe.
# We will now automatically update the tags for develop.
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: pulling tags
run: |
git checkout develop
git pull --tags origin westpa2
git push origin develop --tags
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}