From 8b0e71542f46dfc50a386efcd93fc50269b96a74 Mon Sep 17 00:00:00 2001 From: "narrieta@microsoft" Date: Wed, 15 Jan 2025 08:42:19 -0800 Subject: [PATCH] TEST --- .github/workflows/ci_pr.yml | 66 +++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci_pr.yml b/.github/workflows/ci_pr.yml index 67137a3fd..94fa75cbe 100644 --- a/.github/workflows/ci_pr.yml +++ b/.github/workflows/ci_pr.yml @@ -9,36 +9,41 @@ on: jobs: execute-tests: + name: "Python ${{ matrix.python-version }} Unit Tests" + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: include: + # + # Some of the Python versions we test are not supported by the setup-python Github Action. For those versions, we use a + # pre-built virtual environment. + # - python-version: "2.6" use_virtual_environment: true - python-version: "2.7" use_virtual_environment: true - python-version: "3.4" use_virtual_environment: true -# - python-version: "3.5" -# # workaround found in https://github.com/actions/setup-python/issues/866 -# # for issue "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:728)" on Python 3.5 -# pip_trusted_host: "pypi.python.org pypi.org files.pythonhosted.org" -# - python-version: "3.6" -# - python-version: "3.7" -# - python-version: "3.8" -# - python-version: "3.9" -# additional-nose-opts: "--with-coverage --cover-erase --cover-inclusive --cover-branches --cover-package=azurelinuxagent" -# - python-version: "3.10" -# - python-version: "3.11" - - name: "Python ${{ matrix.python-version }} Unit Tests" - runs-on: ubuntu-20.04 + - python-version: "3.5" + # workaround found in https://github.com/actions/setup-python/issues/866 + # for issue "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:728)" on Python 3.5 + pip_trusted_host: "pypi.python.org pypi.org files.pythonhosted.org" + - python-version: "3.6" + - python-version: "3.7" + - python-version: "3.8" + - python-version: "3.9" + additional-nose-opts: "--with-coverage --cover-erase --cover-inclusive --cover-branches --cover-package=azurelinuxagent" + - python-version: "3.10" + - python-version: "3.11" steps: - - name: Checkout WALinuxAgent uses: actions/checkout@v3 - + # + # We either install Python and the test dependencies, or download a pre-built virtual environment, depending on the + # use_virtual_environment flag. + # - name: Setup Python ${{ matrix.python-version }} if: matrix.use_virtual_environment == false uses: actions/setup-python@v4 @@ -64,13 +69,16 @@ jobs: sudo apt-get install -y curl bzip2 sudo 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 sudo tar xjf /tmp/python-${{ matrix.python-version }}.tar.bz2 --directory / -# # -# # 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. -# # -# if [[ "${{ matrix.python-version }}" =~ ^2\.6|3\.4$ ]]; then -# sudo ./tests/python_eol/patch_python_venv.sh "${{ matrix.python-version }}" -# fi + # + # 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. + # + if [[ "${{ matrix.python-version }}" =~ ^2\.6|3\.4$ ]]; then + sudo ./tests/python_eol/patch_python_venv.sh "${{ matrix.python-version }}" + fi + # + # Execute the tests + # - name: Execute Unit Tests run: | if [[ "${{ matrix.use_virtual_environment}}" == "true" ]]; then @@ -80,13 +88,18 @@ jobs: ./ci/pytest.sh else if [[ "${{ matrix.use_virtual_environment}}" == "true" ]]; then - export NOSEOPTS="--verbose ${{ matrix.additional-nose-opts }}" + export NOSEOPTS="--verbose ${{ matrix.additional-nose-opts }}" # the pytest version on the venv does not support the --with-timer option. else export NOSEOPTS="--verbose --with-timer ${{ matrix.additional-nose-opts }}" fi ./ci/nosetests.sh fi + # + # Execute pylint even when the tests fail (but only if the dependencies were installed successfully) + # + # Note that the virtual environments do not include pylint, so we skip those Python versions. + # - name: Run pylint if: matrix.use_virtual_environment == false && (success() || (failure() && (steps.install-dependencies.outcome == 'success' || steps.install-venv.outcome == 'success'))) run: | @@ -129,7 +142,10 @@ jobs: pylint $PYLINT_OPTIONS $PYLINT_FILES - - name: Compile Coverage + # + # Lastly, compile code coverage + # + - name: Compile Code Coverage if: matrix.python-version == '3.9' run: | echo looking for coverage files : @@ -138,7 +154,7 @@ jobs: sudo env "PATH=$PATH" coverage xml sudo env "PATH=$PATH" coverage report - - name: Upload Coverage + - name: Upload Code Coverage if: matrix.python-version == '3.9' uses: codecov/codecov-action@v3 with: