Skip to content

Reduce execution time of tests #73

Reduce execution time of tests

Reduce execution time of tests #73

Workflow file for this run

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-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python 3.8
uses: ./.github/actions/python
with:
python_version: 3.8
- uses: actions/cache@v3
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
python build_scripts/run_pylint.py | (pylint-json2html -f jsonextended -o pylint.html)
shell: bash
- name: Check Type Hints
run: mypy src/
docs:
name: Build Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python 3.8
uses: ./.github/actions/python
with:
python_version: 3.8
- name: Install Pandoc
uses: r-lib/actions/setup-pandoc@v2
with:
pandoc-version: ${{ env.PANDOC_VERSION }}
- name: Build Docs
run: mkdocs build
base-tests:
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10"]
name: Run base tests
uses: ./.github/workflows/run-tests-workflow.yaml
with:
tests_to_run: base
python_version: ${{ matrix.python_version }}
needs: [code-quality]
torch-tests:
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10"]
name: Run tests that use PyTorch
uses: ./.github/workflows/run-tests-workflow.yaml
with:
tests_to_run: torch
python_version: ${{ matrix.python_version }}
needs: [code-quality]
notebook-tests:
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10"]
name: Run notebook tests
uses: ./.github/workflows/run-tests-workflow.yaml
with:
tests_to_run: notebooks
python_version: ${{ matrix.python_version }}
needs: [code-quality]
push-docs-and-release-testpypi:
name: Push Docs and maybe release Package to TestPyPI
runs-on: ubuntu-latest
needs: [docs, base-tests, torch-tests, notebook-tests]
if: ${{ github.ref == 'refs/heads/develop' }}
concurrency:
group: publish
steps:
- uses: actions/checkout@v3
- name: Setup Python 3.8
uses: ./.github/actions/python
with:
python_version: 3.8
- 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 }}
- name: Build and publish to TestPyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
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
twine upload -r testpypi --verbose --non-interactive dist/*