-
Notifications
You must be signed in to change notification settings - Fork 2
259 lines (226 loc) · 9.21 KB
/
python-package.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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches: [ master, development ]
pull_request:
branches: [ master, development ]
release:
branches: [ master, development ]
# release types see : https://docs.github.com/en/actions/reference/events-that-trigger-workflows#release
# he prereleased type will not trigger for pre-releases published from draft releases, but the published type will trigger.
# If you want a workflow to run when stable and pre-releases publish, subscribe to published instead of released and prereleased.
types: [published]
schedule:
# * is a special character in YAML, so you have to quote this string
# | minute | hour (UTC) | day of month (1-31) | month (1-2) | day of week (0-6 or SUN-SAT)
# every day at 05:40 am UTC - avoid 05:00 because of high load at the beginning of every hour
- cron: '40 5 * * *'
jobs:
build:
runs-on: ${{ matrix.os }}
env:
# prefix before commands - used for wine, there the prefix is "wine"
cPREFIX: ""
# command to launch python interpreter (it's different on macOS, there we need python3)
cPYTHON: "python"
# command to launch pip (it's different on macOS, there we need pip3)
cPIP: "python -m pip"
# switch off wine fix me messages
WINEDEBUG: fixme-all
# PYTEST
PYTEST_DO_TESTS: "True"
# FLAKE8 tests
DO_FLAKE8_TESTS: "True"
# MYPY tests
MYPY_DO_TESTS: "True"
MYPY_OPTIONS: "--follow-imports=normal --ignore-missing-imports --implicit-reexport --install-types --no-warn-unused-ignores --non-interactive --strict"
MYPYPATH: "./.3rd_party_stubs"
# coverage
DO_COVERAGE: "True"
DO_COVERAGE_UPLOAD_CODECOV: "True"
DO_COVERAGE_UPLOAD_CODE_CLIMATE: "True"
# package name
PACKAGE_NAME: "rst_include"
# the registered CLI Command
CLI_COMMAND: "rst_include"
# the source file for rst_include (rebuild rst file includes)
RST_INCLUDE_SOURCE: "./.docs/README_template.rst"
# the target file for rst_include (rebuild rst file includes)
RST_INCLUDE_TARGET: "./README.rst"
# make Code Coverage Secret available in Environment
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
# make PyPi Password available in Environment
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
strategy:
matrix:
include:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-software
# https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#available-versions-of-python-and-pypy
- os: windows-latest
python-version: "3.11"
env:
cEXPORT: "SET"
BUILD_DOCS: "False"
BUILD: "False"
BUILD_TEST: "False"
MYPY_DO_TESTS: "True"
# Setup tests
DO_SETUP_INSTALL: "True"
DO_SETUP_INSTALL_TEST: "True"
# Test registered CLI Command
DO_CLI_TEST: "True"
- os: ubuntu-latest
python-version: "3.8"
env:
BUILD_DOCS: "False"
BUILD: "True"
BUILD_TEST: "True"
MYPY_DO_TESTS: "True"
DO_SETUP_INSTALL: "True"
DO_SETUP_INSTALL_TEST: "True"
DO_CLI_TEST: "True"
- os: ubuntu-latest
python-version: "3.9"
env:
BUILD_DOCS: "False"
BUILD: "True"
BUILD_TEST: "True"
MYPY_DO_TESTS: "True"
DO_SETUP_INSTALL: "True"
DO_SETUP_INSTALL_TEST: "True"
DO_CLI_TEST: "True"
- os: ubuntu-latest
python-version: "3.10"
env:
BUILD_DOCS: "False"
BUILD: "True"
BUILD_TEST: "True"
MYPY_DO_TESTS: "True"
DO_SETUP_INSTALL: "True"
DO_SETUP_INSTALL_TEST: "True"
DO_CLI_TEST: "True"
- os: ubuntu-latest
python-version: "3.11"
env:
BUILD_DOCS: "True"
BUILD: "True"
BUILD_TEST: "True"
MYPY_DO_TESTS: "True"
DO_SETUP_INSTALL: "True"
DO_SETUP_INSTALL_TEST: "True"
DO_CLI_TEST: "True"
- os: ubuntu-latest
python-version: "3.12-dev"
env:
BUILD_DOCS: "True"
BUILD: "True"
BUILD_TEST: "True"
MYPY_DO_TESTS: "True"
DO_SETUP_INSTALL: "True"
DO_SETUP_INSTALL_TEST: "True"
DO_CLI_TEST: "True"
- os: ubuntu-latest
python-version: "pypy-3.9"
env:
BUILD_DOCS: "False"
BUILD: "True"
BUILD_TEST: "True"
MYPY_DO_TESTS: "True"
DO_SETUP_INSTALL: "True"
DO_SETUP_INSTALL_TEST: "True"
DO_CLI_TEST: "True"
- os: ubuntu-latest
python-version: "pypy-3.10"
env:
BUILD_DOCS: "False"
BUILD: "True"
BUILD_TEST: "True"
MYPY_DO_TESTS: "True"
DO_SETUP_INSTALL: "True"
DO_SETUP_INSTALL_TEST: "True"
DO_CLI_TEST: "True"
- os: macos-latest
python-version: "3.11"
env:
cPREFIX: "" # prefix before commands - used for wine, there the prefix is "wine"
cPYTHON: "python3" # command to launch python interpreter (it's different on macOS, there we need python3)
cPIP: "python3 -m pip" # command to launch pip (it's different on macOS, there we need pip3)
BUILD_DOCS: "False"
BUILD: "True"
BUILD_TEST: "True"
MYPY_DO_TESTS: "True"
# Setup tests
DO_SETUP_INSTALL: "True"
DO_SETUP_INSTALL_TEST: "True"
# Test registered CLI Command
DO_CLI_TEST: "True"
name: "${{ matrix.os }} Python ${{ matrix.python-version }}"
steps:
# see : https://github.com/actions/checkout
- uses: actions/checkout@v3
- name: Setting up Python ${{ matrix.python-version }}
# see: https://github.com/actions/setup-python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
# see: https://github.community/t/github-actions-new-bug-unable-to-create-environment-variables-based-matrix/16104/3
env: ${{ matrix.env }} # make matrix env variables accessible
# lib_cicd_github install: upgrades pip, setuptools, wheel and pytest-pycodestyle
run: |
${{ env.cPIP }} install git+https://github.com/bitranox/lib_cicd_github.git
lib_cicd_github install
- name: Debug - printenv and colortest
env:
# make matrix env variables accessible
${{ matrix.env }}
shell: bash
run: |
# export for current step
export "BRANCH=$(lib_cicd_github get_branch)"
# export for subsequent steps
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
log_util --level=SPAM "working on branch $BRANCH"
log_util --level=SPAM "GITHUB_REF $GITHUB_REF"
log_util --level=VERBOSE "github.base_ref: ${{ github.base_ref }}"
log_util --level=VERBOSE "github.event: ${{ github.event }}"
log_util --level=VERBOSE "github.event_name: ${{ github.event_name }}"
log_util --level=VERBOSE "github.head_ref: ${{ github.head_ref }}"
log_util --level=VERBOSE "github.job: ${{ github.job }}"
log_util --level=VERBOSE "github.ref: ${{ github.ref }}"
log_util --level=VERBOSE "github.repository: ${{ github.repository }}"
log_util --level=VERBOSE "github.repository_owner: ${{ github.repository_owner }}"
log_util --level=VERBOSE "runner.os: ${{ runner.os }}"
log_util --level=VERBOSE "matrix.python-version: ${{ matrix.python-version }}"
printenv
log_util --colortest
- name: Run Tests
env:
# make matrix env variables accessible
${{ matrix.env }}
shell: bash
run: |
# export for current step
export "BRANCH=$(lib_cicd_github get_branch)"
# export for subsequent steps
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
# run the tests
lib_cicd_github script
- name: After Success
env:
${{matrix.env }}
shell: bash
continue-on-error: true
run: |
lib_cicd_github after_success
- name: Deploy
env:
# see: https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context
# see : https://github.com/rlespinasse/github-slug-action
# make matrix env variables accessible
${{matrix.env }}
shell: bash
run: |
lib_cicd_github deploy