-
Notifications
You must be signed in to change notification settings - Fork 7
165 lines (135 loc) · 4.5 KB
/
pull-request-checks.yml
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: PR checks
on:
pull_request:
branches: [ main ]
jobs:
pr-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10' ]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
- name: Install the requirements
run: pip install -r requirements.txt
- name: Execute the unittests
run: python3 -m unittest discover tests/unittests
pr-lint:
runs-on: ubuntu-latest
permissions: write-all
strategy:
matrix:
python-version: [ '3.10' ]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
- name: Execute the linting checks
uses: reviewdog/action-flake8@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
flake8_args: --config=.flake8
fail_on_error: true
pr-coverage:
runs-on: ubuntu-latest
permissions: write-all
strategy:
matrix:
python-version: [ '3.10' ]
steps:
- uses: actions/[email protected]
with:
persist-credentials: false
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
- name: Install the requirements
run: pip install -r requirements.txt && pip install pytest-cov coverage-badge
- name: Generate the coverage report
run: export PYTHONPATH=$PWD && pytest --junitxml=pytest.xml --cov=. tests/unittests | tee pytest-coverage.txt
- name: Execute the coverage checks
uses: MishaKav/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml
hide-badge: true
create-new-comment: true
- name: Generate coverage badge
run: coverage-badge -f -o docs/coverage.svg
- name: Check changed files
uses: tj-actions/verify-changed-files@v20
id: verify-changed-files
with:
files: |
docs
- name: Commit files
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add --force docs
git commit -m "docs: Add coverage badge"
- name: Push changes
uses: ad-m/github-push-action@master
if: steps.verify-changed-files.outputs.files_changed == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}
atomic: false
pr-documentation:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.9' ]
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
- name: Install the requirements
run: pip install pydoc-markdown==4.6.3 mkdocs mkdocs-material
- name: Generate documentation
run: pydoc-markdown --render-toc && rm -rf docs/content && mv build/docs/* docs
- name: Check changed files
uses: tj-actions/verify-changed-files@v20
id: verify-changed-files
with:
files: |
docs
- name: Commit files
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add --force docs
git commit -m "docs: Add the documentation"
- name: Push changes
uses: ad-m/github-push-action@master
if: steps.verify-changed-files.outputs.files_changed == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}
pr-integrationtest:
uses: ./.github/workflows/integrationtest.yml
secrets: inherit