Hydride 1.2.2 #32
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on the workflow from https://github.com/biotite-dev/biotite/ | |
# contributed by Daniel Farrell (danpf) and published under the same license | |
name: "CI & CD" | |
on: | |
workflow_dispatch: | |
pull_request: | |
release: | |
types: | |
- published | |
env: | |
CIBW_BUILD: cp310-* cp311-* cp312-* | |
CIBW_ARCHS_LINUX: "x86_64" | |
CIBW_ARCHS_MACOS: "x86_64 arm64" | |
CIBW_ARCHS_WINDOWS: "x86 AMD64" | |
# Skip musllinux because it takes too long to compile on GHA | |
# since it is emulated. (6+ hours) | |
# *note* most of the build time is actually numpy for musllinux | |
CIBW_SKIP: "*musllinux* *-manylinux_i686 *-musllinux_i686 *-win32 pp*" | |
CIBW_TEST_EXTRAS: test | |
CIBW_TEST_COMMAND: pytest {project} --durations=50 | |
CIBW_DEPENDENCY_VERSIONS: "pinned" | |
# Runtime too long due to architecture emulation | |
CIBW_TEST_SKIP: "*-macosx_arm64" | |
jobs: | |
lint: | |
name: Check code style | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install ruff | |
run: pip install ruff==0.5.2 | |
- name: Check code formatting | |
run: ruff format --diff | |
- name: Lint code base | |
run: ruff check | |
test-and-build: | |
name: "Build & Test" | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Build & (optionally) test wheels | |
uses: pypa/[email protected] | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: ./wheelhouse/*.whl | |
if-no-files-found: error | |
make-sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Build source distribution | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/*.tar.gz | |
if-no-files-found: error | |
make-doc: | |
name: Build documentation | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: hydride | |
auto-update-conda: true | |
python-version: '3.11' | |
- name: Installing dependencies | |
run: conda install -c conda-forge sphinx cython numpy numpydoc biotite | |
- name: Building documentation | |
run: sphinx-build ./doc ./build/doc | |
- name: Zipping documentation | |
run: cd .//build; zip -r doc.zip doc; cd .. | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: doc | |
path: build//doc.zip | |
if-no-files-found: error | |
upload: | |
name: Upload to GitHub Releases & PyPI | |
permissions: | |
contents: write | |
needs: | |
- lint | |
- test-and-build | |
- make-sdist | |
- make-doc | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
- name: List distributions to be uploaded | |
run: ls dist | |
- name: Upload to GitHub Releases | |
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 | |
if: github.event_name == 'release' && github.event.action == 'published' | |
with: | |
files: | | |
dist//* | |
doc//* | |
- name: Upload to PyPI | |
uses: pypa/gh-action-pypi-publish@c7f29f7adef1a245bd91520e94867e5c6eedddcc | |
if: github.event_name == 'release' && github.event.action == 'published' | |
with: | |
password: ${{ secrets.PYPI_TOKEN }} |