-
Notifications
You must be signed in to change notification settings - Fork 8
125 lines (122 loc) · 3.89 KB
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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: 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@v3
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-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
group-tests:
strategy:
fail-fast: false
matrix:
python_version: ["3.8", "3.9", "3.10"]
group_number: [1, 2, 3, 4]
name: Run Tests - Python ${{ matrix.python_version }} - Group ${{ matrix.group_number }}
uses: ./.github/workflows/run-tests-workflow.yaml
with:
split_size: 4
group_number: ${{ matrix.group_number }}
python_version: ${{ matrix.python_version }}
needs: [code-quality]
notebook-tests:
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10"]
name: Run Notebook tests - Python ${{ matrix.python_version }}
uses: ./.github/workflows/run-notebook-tests-workflow.yaml
with:
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, group-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/*