DeepSets for DUL #850
This file contains hidden or 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: Tests, docs, package | |
on: | |
push: | |
branches: [develop, master] | |
pull_request: | |
branches: [develop] | |
workflow_dispatch: | |
inputs: | |
reason: | |
description: Why did you trigger the pipeline? | |
required: False | |
default: Check if it runs again due to external changes | |
env: | |
GITHUB_BOT_USERNAME: github-actions[bot] | |
GITHUB_BOT_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | |
PY_COLORS: 1 | |
MYPY_FORCE_COLOR: 1 | |
PANDOC_VERSION: '3.1.6.2' | |
jobs: | |
code-quality: | |
name: Lint code and check type hints | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python 3.9 | |
uses: ./.github/actions/python | |
with: | |
python_version: 3.9 | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit-${{ env.pythonLocation }}-${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Lint Code | |
run: | | |
pre-commit run --all --show-diff-on-failure | |
ruff check src/ --fix | |
shell: bash | |
- name: Generate mypy cache key | |
id: generate-mypy-cache-key | |
run: | | |
MYPY_VERSION=$(mypy --version | sed 's/[^0-9.]*\([0-9.]*\).*/\1/') | |
echo "key=mypy-$MYPY_VERSION-${{ env.pythonLocation }}" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
with: | |
path: .mypy_cache | |
key: ${{ steps.generate-mypy-cache-key.outputs.key }} | |
- name: Check Type Hints | |
run: mypy src/ | |
docs: | |
name: Build Docs | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Setup Python 3.9 | |
uses: ./.github/actions/python | |
with: | |
python_version: 3.9 | |
- name: Install Pandoc | |
uses: r-lib/actions/setup-pandoc@v2 | |
with: | |
pandoc-version: ${{ env.PANDOC_VERSION }} | |
- name: Build Docs | |
run: mkdocs build | |
group-tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
python_version: ["3.9", "3.10", "3.11", "3.12"] | |
group_number: [1, 2, 3, 4] | |
name: Run Tests - Python ${{ matrix.python_version }} - Group ${{ matrix.group_number }} | |
uses: ./.github/workflows/run-tests-workflow.yaml | |
secrets: inherit | |
with: | |
split_size: 4 | |
group_number: ${{ matrix.group_number }} | |
python_version: ${{ matrix.python_version }} | |
needs: [code-quality] | |
notebook-tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
python_version: ["3.9", "3.10", "3.11", "3.12"] | |
group_number: [1, 2, 3, 4] | |
name: Run Notebook tests - Python ${{ matrix.python_version }} - Group ${{ matrix.group_number }} | |
uses: ./.github/workflows/run-notebook-tests-workflow.yaml | |
with: | |
python_version: ${{ matrix.python_version }} | |
split_size: 4 | |
group_number: ${{ matrix.group_number }} | |
needs: [code-quality] | |
legacy-tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
python_version: [ "3.11" ] | |
group_number: [ 1, 2, 3, 4 ] | |
name: Run Legacy tests - Python ${{ matrix.python_version }} - Group ${{ matrix.group_number }} | |
uses: ./.github/workflows/run-legacy-tests-workflow.yaml | |
with: | |
python_version: ${{ matrix.python_version }} | |
split_size: 4 | |
group_number: ${{ matrix.group_number }} | |
needs: [ code-quality ] | |
publish-docs: | |
name: Publish documentation | |
runs-on: ubuntu-22.04 | |
needs: [docs, group-tests, notebook-tests] | |
if: ${{ github.ref == 'refs/heads/develop' && github.event_name != 'pull_request' }} | |
concurrency: | |
group: publish-docs | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Setup Python 3.9 | |
uses: ./.github/actions/python | |
with: | |
python_version: 3.9 | |
- name: Install Pandoc | |
uses: r-lib/actions/setup-pandoc@v2 | |
with: | |
pandoc-version: ${{ env.PANDOC_VERSION }} | |
- name: Deploy docs | |
uses: ./.github/actions/deploy-docs | |
with: | |
version: devel | |
alias: develop | |
title: Development | |
email: ${{ env.GITHUB_BOT_EMAIL }} | |
username: ${{ env.GITHUB_BOT_USERNAME }} | |
publish-testpypi: | |
name: Publish package to TestPyPI | |
runs-on: ubuntu-22.04 | |
needs: [group-tests, notebook-tests] | |
if: ${{ github.ref == 'refs/heads/develop' && github.event_name != 'pull_request' }} | |
concurrency: | |
group: publish-testpypi | |
permissions: | |
id-token: write | |
environment: | |
name: testpypi | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Setup Python 3.9 | |
uses: ./.github/actions/python | |
with: | |
python_version: 3.9 | |
- name: Bump version and build package | |
run: | | |
set -x | |
export BUILD_NUMBER=$GITHUB_RUN_NUMBER | |
bump2version --no-tag --no-commit --verbose --serialize '{major}.{minor}.{patch}.{release}{$BUILD_NUMBER}' boguspart | |
python setup.py sdist bdist_wheel | |
- name: Publish to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
print-hash: true | |
verbose: true |