scikit_mol ci #15
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
name: scikit_mol ci | |
on: | |
push: | |
branches: [main] | |
tags: ['v*'] | |
pull_request: | |
branches: [main] | |
# cancel previously running tests if new commits are made | |
# https://docs.github.com/en/actions/examples/using-concurrency-expressions-and-a-test-matrix | |
concurrency: | |
group: actions-id-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# run pytests for scikit_mol | |
tests: | |
name: pytest ${{ matrix.os }}::py${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
max-parallel: 6 | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.10"] | |
include: | |
# test python version compatibility on linux only | |
- os: ubuntu-latest | |
python-version: 3.13 | |
- os: ubuntu-latest | |
python-version: 3.12 | |
- os: ubuntu-latest | |
python-version: 3.11 | |
- os: ubuntu-latest | |
python-version: 3.10 | |
- os: ubuntu-latest | |
python-version: 3.9 | |
steps: | |
- name: Checkout scikit_mol | |
uses: actions/checkout@v4 | |
- name: Install uv and set the python version | |
uses: astral-sh/setup-uv@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install scikit_mol | |
run: uv sync --dev | |
- name: Cache tests/data | |
uses: actions/cache@v4 | |
with: | |
path: tests/data | |
key: ${{ runner.os }}-${{ hashFiles('tests/conftest.py') }} | |
- name: Run Tests | |
run: uv run pytest --cov=./scikit_mol . | |
build-and-create-signed-release: | |
name: Build distribution📦 & create Github Release | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
needs: tests | |
uses: ./.github/workflows/publish.yaml | |
with: | |
python-version: "3.9" | |
is-draft: true | |
publish: | |
name: Publish to PyPI | |
needs: build-and-create-signed-release | |
runs-on: ubuntu-latest | |
# will be enable in the future | |
# environment: | |
# name: pypi | |
# url: https://pypi.org/p/scikit-mol | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |