-
Notifications
You must be signed in to change notification settings - Fork 17
242 lines (190 loc) · 6.79 KB
/
main.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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
name: Main
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
project-name: pymarkdown
default-python-version: 3.13
jobs:
lint:
name: Project Quality Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Python ${{ env.default-python-version }}
uses: actions/[email protected]
with:
python-version: ${{ env.default-python-version }}
- name: Install PipEnv
run: |
pip install pipenv==2023.12.1
- name: Sync With Repository
run: |
pipenv lock --clear --python ${{ env.default-python-version }}
pipenv sync -d
pipenv graph
- name: Execute Pre-Commit
run: |
pipenv run pre-commit run --all
- name: Execute PyMarkdown on Current Docs
run: pipenv run python ${{github.workspace}}/main.py --config ${{github.workspace}}/clean.json scan ${{github.workspace}} ${{github.workspace}}/docs
doc-lint:
name: Document Quality Analysis
runs-on: ubuntu-latest
needs: [ lint ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Python ${{ env.default-python-version }}
uses: actions/[email protected]
with:
python-version: ${{ env.default-python-version }}
- name: Install PipEnv
run: |
pip install pipenv==2023.12.1
- name: Sync With Repository
run: |
pipenv lock --clear --python ${{ env.default-python-version }}
pipenv sync -d
pipenv graph
- name: Execute PyMarkdown on NewDocs
run: |
pipenv run python main.py --config newdocs/clean.json scan newdocs/src
# - name: Execute MdFormat on Docs
# run: |
# cd newdocs
# pipenv run mdformat --align-semantic-breaks-in-lists --wrap 80 --check .
scenario-tests:
name: Scenario Tests
strategy:
matrix:
python: ["3.13"]
platform: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
needs: [ lint ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python }}
- name: Install PipEnv
run: |
pip install pipenv==2023.12.1
- name: Sync With Repository
run: |
pipenv lock --clear --python ${{ env.default-python-version }}
pipenv sync -d
pipenv graph
pipenv uninstall pytest-html
- name: Execute Tests
run: pipenv run pytest --cov-fail-under=90 --cov --cov-branch --cov-report xml:report/coverage.xml
- name: Archive coverage artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }} Coverage
path: |
./report/coverage.xml
- name: Report Coverage
uses: codecov/codecov-action@v4
if: github.event_name != 'schedule'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./report/coverage.xml
name: ${{ matrix.python }} - ${{ matrix.platform }}
fail_ci_if_error: true
expanded-scenario-tests:
name: Scenario Tests
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12"]
platform: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
needs: [ scenario-tests ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python }}
- name: Install PipEnv
run: |
pip install pipenv==2023.12.1
- name: Sync With Repository
run: |
rm Pipfile.lock
pipenv lock --clear --python ${{ matrix.python }}
pipenv sync -d
pipenv graph
pipenv uninstall pytest-html
- name: Execute Tests
run: pipenv run pytest --cov-fail-under=90 --cov --cov-branch --cov-report xml:report/coverage.xml
packaging:
name: Package Application
runs-on: ubuntu-latest
needs: [ doc-lint, lint, scenario-tests ]
# if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Python ${{ env.default-python-version }}
uses: actions/[email protected]
with:
python-version: ${{ env.default-python-version }}
- name: Install PipEnv
run: |
pip install pipenv==2023.12.1
- name: Sync With Repository
run: |
pipenv lock --clear --python ${{ env.default-python-version }}
pipenv sync -d
pipenv graph
- name: Pyroma
run: |
pipenv run pyroma -q -n 10 .
- name: Setup
run: |
pipenv run python setup.py sdist bdist_wheel
- name: Twine
run: |
pipenv run twine check dist/*
- name: Upload Package
uses: actions/upload-artifact@v4
with:
name: my-artifact
path: ${{github.workspace}}/dist/
- name: Initiating Integration Tests
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
ACTION_SHA=
if [ "${{ github.event_name }}" == "pull_request" ] ; then
ACTION_SHA=${{ github.event.pull_request.head.sha }}
elif [ "${{ github.event_name }}" == "push" ] ; then
ACTION_SHA=${{ github.event.head_commit.id }}
else
echo "$GITHUB_CONTEXT"
ACTION_SHA=$GITHUB_SHA
fi
ACTION_RUN_ID=${{ github.run_id }}
ACCESS_TOKEN=${{ secrets.INTER_PROJECT_ACCESS_TOKEN }}
if [ -z "$ACCESS_TOKEN" ] ; then
echo "Secret 'INTER_PROJECT_ACCESS_TOKEN' has not been set to a non-empty value."
exit 1
else
echo "SHA=$ACTION_SHA"
echo "RUN_ID=$ACTION_RUN_ID"
echo '{"event_type": "request-integration", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'", "ref":"'"$GITHUB_REF"'", "sha": "'"$ACTION_SHA"'", "run_id" : "'"$ACTION_RUN_ID"'" }}'
curl -X POST https://api.github.com/repos/jackdewinter/pymarkdown_test/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u '${{ secrets.INTER_PROJECT_ACCESS_TOKEN }}' \
--data '{"event_type": "request-integration", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'", "ref":"'"$GITHUB_REF"'", "sha": "'"$ACTION_SHA"'", "run_id" : "'"$ACTION_RUN_ID"'" }}'
fi