-
Notifications
You must be signed in to change notification settings - Fork 8
143 lines (140 loc) · 4.31 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
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-1-tests:
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10"]
name: Run Group 1 tests
uses: ./.github/workflows/run-tests-workflow.yaml
with:
tests_to_run: group1
python_version: ${{ matrix.python_version }}
needs: [code-quality]
group-2-tests:
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10"]
name: Run Group 2 tests
uses: ./.github/workflows/run-tests-workflow.yaml
with:
tests_to_run: group2
python_version: ${{ matrix.python_version }}
needs: [code-quality]
group-3-tests:
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10"]
name: Run Group 3 tests
uses: ./.github/workflows/run-tests-workflow.yaml
with:
tests_to_run: group3
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, group-1-tests, group-2-tests, group-3-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/*