9
9
10
10
jobs :
11
11
execute-tests :
12
+ name : " Python ${{ matrix.python-version }} Unit Tests"
13
+ runs-on : ubuntu-20.04
12
14
strategy :
13
15
fail-fast : false
14
16
matrix :
15
17
include :
18
+ #
19
+ # Some of the Python versions we test are not supported by the setup-python Github Action. For those versions, we use a
20
+ # pre-built virtual environment.
21
+ #
16
22
- python-version : " 2.6"
17
23
use_virtual_environment : true
18
24
- python-version : " 2.7"
19
25
use_virtual_environment : true
20
26
- python-version : " 3.4"
21
27
use_virtual_environment : true
22
- # - python-version: "3.5"
23
- # # workaround found in https://github.com/actions/setup-python/issues/866
24
- # # for issue "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:728)" on Python 3.5
25
- # pip_trusted_host: "pypi.python.org pypi.org files.pythonhosted.org"
26
- # - python-version: "3.6"
27
- # - python-version: "3.7"
28
- # - python-version: "3.8"
29
- # - python-version: "3.9"
30
- # additional-nose-opts: "--with-coverage --cover-erase --cover-inclusive --cover-branches --cover-package=azurelinuxagent"
31
- # - python-version: "3.10"
32
- # - python-version: "3.11"
33
-
34
- name : " Python ${{ matrix.python-version }} Unit Tests"
35
- runs-on : ubuntu-20.04
28
+ - python-version : " 3.5"
29
+ # workaround found in https://github.com/actions/setup-python/issues/866
30
+ # for issue "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:728)" on Python 3.5
31
+ pip_trusted_host : " pypi.python.org pypi.org files.pythonhosted.org"
32
+ - python-version : " 3.6"
33
+ - python-version : " 3.7"
34
+ - python-version : " 3.8"
35
+ - python-version : " 3.9"
36
+ additional-nose-opts : " --with-coverage --cover-erase --cover-inclusive --cover-branches --cover-package=azurelinuxagent"
37
+ - python-version : " 3.10"
38
+ - python-version : " 3.11"
36
39
37
40
steps :
38
-
39
41
- name : Checkout WALinuxAgent
40
42
uses : actions/checkout@v3
41
-
43
+ #
44
+ # We either install Python and the test dependencies, or download a pre-built virtual environment, depending on the
45
+ # use_virtual_environment flag.
46
+ #
42
47
- name : Setup Python ${{ matrix.python-version }}
43
48
if : matrix.use_virtual_environment == false
44
49
uses : actions/setup-python@v4
@@ -64,13 +69,16 @@ jobs:
64
69
sudo apt-get install -y curl bzip2 sudo
65
70
curl -sSf --retry 5 -o /tmp/python-${{ matrix.python-version }}.tar.bz2 https://dcrdata.blob.core.windows.net/python/python-${{ matrix.python-version }}.tar.bz2
66
71
sudo tar xjf /tmp/python-${{ matrix.python-version }}.tar.bz2 --directory /
67
- # #
68
- # # The virtual environments for 2.6 and 3.4 have dependencies on OpenSSL 1.0, which is not available beyond Ubuntu 16. We use this script to patch the environments.
69
- # #
70
- # if [[ "${{ matrix.python-version }}" =~ ^2\.6|3\.4$ ]]; then
71
- # sudo ./tests/python_eol/patch_python_venv.sh "${{ matrix.python-version }}"
72
- # fi
72
+ #
73
+ # The virtual environments for 2.6 and 3.4 have dependencies on OpenSSL 1.0, which is not available beyond Ubuntu 16. We use this script to patch the environments.
74
+ #
75
+ if [[ "${{ matrix.python-version }}" =~ ^2\.6|3\.4$ ]]; then
76
+ sudo ./tests/python_eol/patch_python_venv.sh "${{ matrix.python-version }}"
77
+ fi
73
78
79
+ #
80
+ # Execute the tests
81
+ #
74
82
- name : Execute Unit Tests
75
83
run : |
76
84
if [[ "${{ matrix.use_virtual_environment}}" == "true" ]]; then
@@ -80,13 +88,18 @@ jobs:
80
88
./ci/pytest.sh
81
89
else
82
90
if [[ "${{ matrix.use_virtual_environment}}" == "true" ]]; then
83
- export NOSEOPTS="--verbose ${{ matrix.additional-nose-opts }}"
91
+ export NOSEOPTS="--verbose ${{ matrix.additional-nose-opts }}" # the pytest version on the venv does not support the --with-timer option.
84
92
else
85
93
export NOSEOPTS="--verbose --with-timer ${{ matrix.additional-nose-opts }}"
86
94
fi
87
95
./ci/nosetests.sh
88
96
fi
89
97
98
+ #
99
+ # Execute pylint even when the tests fail (but only if the dependencies were installed successfully)
100
+ #
101
+ # Note that the virtual environments do not include pylint, so we skip those Python versions.
102
+ #
90
103
- name : Run pylint
91
104
if : matrix.use_virtual_environment == false && (success() || (failure() && (steps.install-dependencies.outcome == 'success' || steps.install-venv.outcome == 'success')))
92
105
run : |
@@ -129,7 +142,10 @@ jobs:
129
142
130
143
pylint $PYLINT_OPTIONS $PYLINT_FILES
131
144
132
- - name : Compile Coverage
145
+ #
146
+ # Lastly, compile code coverage
147
+ #
148
+ - name : Compile Code Coverage
133
149
if : matrix.python-version == '3.9'
134
150
run : |
135
151
echo looking for coverage files :
@@ -138,7 +154,7 @@ jobs:
138
154
sudo env "PATH=$PATH" coverage xml
139
155
sudo env "PATH=$PATH" coverage report
140
156
141
- - name : Upload Coverage
157
+ - name : Upload Code Coverage
142
158
if : matrix.python-version == '3.9'
143
159
uses : codecov/codecov-action@v3
144
160
with :
0 commit comments