-
Notifications
You must be signed in to change notification settings - Fork 1
130 lines (115 loc) · 4.28 KB
/
github-action-ci.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
name: GitHub CI Action
on: ["push", "pull_request"]
jobs:
#####----- MYTEMPLATE FULL TESTING OF INSTALLED PACKAGE WITHOUT COVERAGE
test_mytemplate:
runs-on: ${{ matrix.os }}
strategy:
# python-versions must be maintained consistent with associated setup.py
# and tox.ini configuration.
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
##-- General Setup Steps
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup python with tox
run: ./.github/workflows/setup_tox_github_action.sh
##-- Test Execution Step
- name: Test mytemplate python package
run: |
pushd mytemplate_pypkg
tox -r -e nocoverage
popd
#####----- MYTEMPLATE2 FULL TESTING OF INSTALLED PACKAGE WITHOUT COVERAGE
test_mytemplate2:
runs-on: ${{ matrix.os }}
strategy:
# python-versions must be maintained consistent with associated setup.py
# and tox.ini configuration.
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11"]
steps:
##-- General Setup Steps
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup python with tox
run: ./.github/workflows/setup_tox_github_action.sh
##-- Test Execution Step
- name: Test mytemplate2 python package
run: |
pushd mytemplate2_pypkg
tox -r -e nocoverage
popd
#####----- MEASURE COVERAGE ACROSS ALL PACKAGES
coverage_ubuntu:
runs-on: ubuntu-latest
strategy:
# We only need to measure coverage with a single python version, and we
# must pick a version that all packages include via tox. Ideally this
# will be the latest version of python used in the action.
matrix:
python-version: ["3.11"]
steps:
##-- General Setup Steps
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup python with tox
run: ./.github/workflows/setup_tox_github_action.sh
##-- Run Coverage for All Packages
# Coverage is full test suite run on local clone so that coveralls
# has nice output. Generate html report to export as artifact.
- name: Generate all coverage for coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# We want to preserve all individual coverage results as artifacts.
# Therefore, save each of these to a unique file .coverage_<package name>
# Save all in root of repo for later aggregation.
pushd mytemplate_pypkg
COVERAGE_FILE=../.coverage_mytemplate tox -r -e coverage
popd
pushd mytemplate2_pypkg
COVERAGE_FILE=../.coverage_mytemplate2 tox -r -e coverage
popd
# This aggregates into .coverage for coveralls
tox -r -e aggregate,coveralls,report -- ./.coverage_*
##-- Publish full coverage report as artifact
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-results
path: |
.coverage*
htmlcov
##-- Publish mytemplate distributions
# These are pure python and don't depend on OS or python version used
# for testing
- name: Archive tested mytemplate distributions
uses: actions/upload-artifact@v3
with:
name: tested-mytemplate-packages
path: |
mytemplate_pypkg/.tox/.pkg/dist/mytemplate-*.whl
mytemplate_pypkg/.tox/.pkg/dist/mytemplate-*.tar.gz
##-- Publish mytemplate2 distributions
# These are pure python and don't depend on OS or python version used
# for testing
- name: Archive tested mytemplate2 distributions
uses: actions/upload-artifact@v3
with:
name: tested-mytemplate2-packages
path: |
mytemplate2_pypkg/.tox/.pkg/dist/mytemplate2-*.whl
mytemplate2_pypkg/.tox/.pkg/dist/mytemplate2-*.tar.gz