Skip to content

Commit 8b0e715

Browse files
author
narrieta@microsoft
committed
TEST
1 parent 4f7fce2 commit 8b0e715

File tree

1 file changed

+41
-25
lines changed

1 file changed

+41
-25
lines changed

.github/workflows/ci_pr.yml

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,41 @@ on:
99

1010
jobs:
1111
execute-tests:
12+
name: "Python ${{ matrix.python-version }} Unit Tests"
13+
runs-on: ubuntu-20.04
1214
strategy:
1315
fail-fast: false
1416
matrix:
1517
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+
#
1622
- python-version: "2.6"
1723
use_virtual_environment: true
1824
- python-version: "2.7"
1925
use_virtual_environment: true
2026
- python-version: "3.4"
2127
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"
3639

3740
steps:
38-
3941
- name: Checkout WALinuxAgent
4042
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+
#
4247
- name: Setup Python ${{ matrix.python-version }}
4348
if: matrix.use_virtual_environment == false
4449
uses: actions/setup-python@v4
@@ -64,13 +69,16 @@ jobs:
6469
sudo apt-get install -y curl bzip2 sudo
6570
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
6671
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
7378
79+
#
80+
# Execute the tests
81+
#
7482
- name: Execute Unit Tests
7583
run: |
7684
if [[ "${{ matrix.use_virtual_environment}}" == "true" ]]; then
@@ -80,13 +88,18 @@ jobs:
8088
./ci/pytest.sh
8189
else
8290
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.
8492
else
8593
export NOSEOPTS="--verbose --with-timer ${{ matrix.additional-nose-opts }}"
8694
fi
8795
./ci/nosetests.sh
8896
fi
8997
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+
#
90103
- name: Run pylint
91104
if: matrix.use_virtual_environment == false && (success() || (failure() && (steps.install-dependencies.outcome == 'success' || steps.install-venv.outcome == 'success')))
92105
run: |
@@ -129,7 +142,10 @@ jobs:
129142
130143
pylint $PYLINT_OPTIONS $PYLINT_FILES
131144
132-
- name: Compile Coverage
145+
#
146+
# Lastly, compile code coverage
147+
#
148+
- name: Compile Code Coverage
133149
if: matrix.python-version == '3.9'
134150
run: |
135151
echo looking for coverage files :
@@ -138,7 +154,7 @@ jobs:
138154
sudo env "PATH=$PATH" coverage xml
139155
sudo env "PATH=$PATH" coverage report
140156
141-
- name: Upload Coverage
157+
- name: Upload Code Coverage
142158
if: matrix.python-version == '3.9'
143159
uses: codecov/codecov-action@v3
144160
with:

0 commit comments

Comments
 (0)