Skip to content

Add functionalities related to aromatic rings #811

Add functionalities related to aromatic rings

Add functionalities related to aromatic rings #811

Workflow file for this run

---
name: "CI & CD"
on:
workflow_dispatch:
push:
branches:
- "main"
pull_request:
permissions:
contents: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CIBW_BUILD: cp310-* cp311-* cp312-* cp313-*
CIBW_TEST_EXTRAS: test
CIBW_TEST_COMMAND: >
pytest {project}
--durations=50
--ignore={project}//tests//sequence//align//test_statistics.py
--ignore={project}//tests//application
--ignore={project}//tests//interface
--ignore={project}//tests//database
--ignore={project}//tests//test_doctest.py
--ignore={project}//tests//test_modname.py
CIBW_DEPENDENCY_VERSIONS: "pinned"
# Once GHA and cibuildwheel are updated this can be removed
# mussllinux takes 6+ hrs to build and test so ignore it
CIBW_TEST_SKIP: "*musllinux* *-macosx_arm64"
# Configuration for the architecture-agnostic jobs
PY_VERSION: "3.11" # Keep in sync with version in environment.yml
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
# Keep in sync with the ruff version in pyproject.toml
run: pip install ruff==0.6.9
- name: Check code formatting
run: ruff format --diff
- name: Lint code base
run: ruff check
build-internal:
name: Build CCD and wheel for reusing it in several CI jobs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Make sure to fetch the latest tag,
# so 'switcher.py' works correctly in 'docs' job
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PY_VERSION }}
- name: Get current CCD for hashing
run: wget https://files.wwpdb.org/pub/pdb/data/monomers/components.cif.gz
- name: Cache CCD
uses: actions/cache@v4
id: cache-ccd
with:
path: ./src/biotite/structure/info/components.bcif
key: cache-${{ hashFiles('src/biotite/setup_ccd.py') }}-${{ hashFiles('components.cif.gz') }}
- name: Remove CCD used for hashing
run: rm components.cif.gz
- name: Build internal CCD
if: steps.cache-ccd.outputs.cache-hit != 'true'
run: |
pip install -e .
python -m biotite.setup_ccd
- name: Install build backend
run: pip install build
- name: Build distribution
run: python -m build --wheel
- uses: actions/upload-artifact@v4
with:
name: internal-build
path: ./dist/*.whl
- uses: actions/upload-artifact@v4
with:
name: ccd
path: ./src/biotite/structure/info/components.bcif
generate-wheels-matrix:
name: "Generate wheels matrix"
runs-on: "ubuntu-latest"
outputs:
include: ${{ steps.set-matrix.outputs.include }}
steps:
- uses: actions/checkout@v4
- name: Install cibuildwheel
# MAKE SURE THIS STAYS IN SYNC WITH THE LOWER GHA cibuildwheel
run: pipx install cibuildwheel==2.20.0
- id: set-matrix
run: |
MATRIX=$(
{
cibuildwheel --print-build-identifiers --platform linux \
| jq -nRc '{"dist": inputs, "os": "ubuntu-latest"}' \
&& cibuildwheel --print-build-identifiers --platform macos \
| jq -nRc '{"dist": inputs, "os": "macos-latest"}'
} | jq -sc
)
echo "include=$MATRIX" | tee -a $GITHUB_OUTPUT
env:
CIBW_ARCHS_LINUX: "x86_64"
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_SKIP: "*musllinux* *-manylinux_i686 *-musllinux_i686 pp*"
test-and-build:
name: "Build & Test"
needs:
- generate-wheels-matrix
- build-internal
strategy:
matrix:
include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Add internal CCD to Biotite
uses: actions/download-artifact@v4
with:
name: ccd
path: src/biotite/structure/info
- name: Checkout actions
uses: actions/checkout@v4
with:
repository: aivant/actions
token: ${{ secrets.COMPOSITE_ACTIONS_TOKEN }}
ref: v4
path: actions
- name: Create tag for new internal release
uses: ./actions/git/tag
id: get-tag
# QEMU enables building/testing for non-native architectures (ie arm64)
# at the cost of speed
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Build & (optionally) test wheels
# MAKE SURE THIS STAYS IN SYNC WITH THE UPPER pipx call to cibuildwheel
uses: pypa/[email protected]
with:
only: ${{ matrix.dist }}
- uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.dist }}
path: ./wheelhouse/*.whl
sdist:
name: Build source distribution
runs-on: ubuntu-latest
needs:
- build-internal
steps:
- uses: actions/checkout@v4
- name: Add internal CCD to Biotite
uses: actions/download-artifact@v4
with:
name: ccd
path: src/biotite/structure/info
- uses: actions/checkout@v4
with:
repository: aivant/actions
token: ${{ secrets.COMPOSITE_ACTIONS_TOKEN }}
ref: v4
path: actions
- uses: ./actions/git/tag
id: get-tag
- name: Build source distribution
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: release-sdist
path: dist//*.tar.gz
publish:
name: Upload to internal package index
if: github.ref == 'refs/heads/main'
needs:
- lint
- test-and-build
- sdist
runs-on: ubuntu-latest
environment:
name: publish
url: https://pypi.org/p/biotite
steps:
- name: Checkout actions
uses: actions/checkout@v4
with:
repository: aivant/actions
token: ${{ secrets.COMPOSITE_ACTIONS_TOKEN }}
ref: v4
path: actions
- uses: actions/download-artifact@v4
with:
pattern: release-*
merge-multiple: true
# Cannot use 'dist' as it would indicate to py/publish
# that it should build the wheels itself
path: wheelhouse
- name: List distributions to be uploaded
run: ls wheelhouse
- name: Upload to internal package index
uses: ./actions/py/publish
with:
sa-name: default-gha
wheel-directory: wheelhouse
tag:
name: Save updated git tag
if: github.ref == 'refs/heads/main'
needs: publish
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Checkout actions
uses: actions/checkout@v4
with:
repository: aivant/actions
token: ${{ secrets.COMPOSITE_ACTIONS_TOKEN }}
ref: v4
path: actions
- name: Create tag for new internal release
uses: ./actions/git/tag
id: get-tag
- name: Save git tag
if: steps.get-tag.outputs.tag-name != ''
run: git push origin ${{ steps.get-tag.outputs.tag-name }}