Skip to content

Use xml coverage, delete tox env. "report" #6

Use xml coverage, delete tox env. "report"

Use xml coverage, delete tox env. "report" #6

Workflow file for this run

name: Run tests, build docs, publish to TestPyPI
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
jobs:
lint:
name: Lint code and check type hints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: 'pip'
- name: Install Dev Requirements
run: pip install -r requirements-dev.txt
- name: Cache Tox Directory for Linting
uses: actions/cache@v3
with:
key: tox-${{ github.ref }}-${{ runner.os }}-${{ hashFiles('tox.ini') }}
path: .tox
- name: Lint Code
run: tox -e linting
- name: Check Type Hints
run: tox -e type-checking
docs:
name: Build Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: 'pip'
- name: Install Dev Requirements
run: pip install -r requirements-dev.txt
- name: Install Pandoc
run: sudo apt-get install --no-install-recommends --yes pandoc
- name: Cache Tox Directory for Docs
uses: actions/cache@v3
with:
key: tox-${{ github.ref }}-${{ runner.os }}-${{ hashFiles('tox.ini') }}
path: .tox
- name: Build Docs
run: tox -e docs
- name: Save built docs
uses: actions/upload-artifact@v3
with:
name: docs
path: ./docs/_build
retention-days: 1
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: [lint]
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: [lint]
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: [lint]
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]
concurrency:
group: push-docs-and-release-testpypi
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: 'pip'
- name: Install Dev Requirements
run: pip install -r requirements-dev.txt
- name: Cache Tox Directory
uses: actions/cache@v3
with:
key: tox-${{ github.ref }}-${{ runner.os }}-${{ hashFiles('tox.ini') }}
path: .tox
- name: Download built docs
uses: actions/download-artifact@v3
with:
name: docs
path: ./docs/_build
- name: Deploy Docs
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/develop' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
user_name: ${{ env.GITHUB_BOT_USERNAME }}
user_email: ${{ env.GITHUB_BOT_EMAIL }}
- name: Build and publish to TestPyPI
if: ${{ github.ref == 'refs/heads/develop' }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
run: |
set -x
export CURRENT_VERSION=$(python setup.py --version)
export BUILD_NUMBER=$GITHUB_RUN_NUMBER
tox -e bump-dev-version
tox -e publish-test-package