Skip to content

Merge pull request #3236 from Azure/hotfix-2.11.1.9 #3754

Merge pull request #3236 from Azure/hotfix-2.11.1.9

Merge pull request #3236 from Azure/hotfix-2.11.1.9 #3754

Workflow file for this run

name: CI Unit tests
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]
workflow_dispatch:
jobs:
test-python-2_6-and-3_4-versions:
strategy:
fail-fast: false
matrix:
include:
- python-version: 2.6
- python-version: 3.4
name: "Python ${{ matrix.python-version }} Unit Tests"
runs-on: ubuntu-20.04
container:
image: ubuntu:16.04
volumes:
- /home/waagent:/home/waagent
defaults:
run:
shell: bash -l {0}
env:
NOSEOPTS: "--verbose"
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- uses: actions/checkout@v3
- name: Install Python ${{ matrix.python-version }}
run: |
apt-get update
apt-get install -y curl bzip2 sudo python3
curl https://dcrdata.blob.core.windows.net/python/python-${{ matrix.python-version }}.tar.bz2 -o python-${{ matrix.python-version }}.tar.bz2
sudo tar xjvf python-${{ matrix.python-version }}.tar.bz2 --directory /
- name: Test with nosetests
run: |
if [[ ${{ matrix.python-version }} == 2.6 ]]; then
source /home/waagent/virtualenv/python2.6.9/bin/activate
else
source /home/waagent/virtualenv/python3.4.8/bin/activate
fi
./ci/nosetests.sh
exit $?
test-python-2_7:
strategy:
fail-fast: false
name: "Python 2.7 Unit Tests"
runs-on: ubuntu-20.04
defaults:
run:
shell: bash -l {0}
env:
NOSEOPTS: "--verbose"
steps:
- uses: actions/checkout@v3
- name: Install Python 2.7
run: |
apt-get update
apt-get install -y curl bzip2 sudo
curl https://dcrdata.blob.core.windows.net/python/python-2.7.tar.bz2 -o python-2.7.tar.bz2
sudo tar xjvf python-2.7.tar.bz2 --directory /
- name: Test with nosetests
run: |
source /home/waagent/virtualenv/python2.7.16/bin/activate
./ci/nosetests.sh
exit $?
test-current-python-versions:
strategy:
fail-fast: false
matrix:
include:
- python-version: 3.5
PYLINTOPTS: "--rcfile=ci/3.6.pylintrc --ignore=tests_e2e,makepkg.py"
- python-version: 3.6
PYLINTOPTS: "--rcfile=ci/3.6.pylintrc --ignore=tests_e2e"
- python-version: 3.7
PYLINTOPTS: "--rcfile=ci/3.6.pylintrc --ignore=tests_e2e"
- python-version: 3.8
PYLINTOPTS: "--rcfile=ci/3.6.pylintrc --ignore=tests_e2e"
- python-version: 3.9
PYLINTOPTS: "--rcfile=ci/3.6.pylintrc"
additional-nose-opts: "--with-coverage --cover-erase --cover-inclusive --cover-branches --cover-package=azurelinuxagent"
name: "Python ${{ matrix.python-version }} Unit Tests"
runs-on: ubuntu-20.04
env:
PYLINTOPTS: ${{ matrix.PYLINTOPTS }}
PYLINTFILES: "azurelinuxagent setup.py makepkg.py tests tests_e2e"
NOSEOPTS: "--with-timer ${{ matrix.additional-nose-opts }}"
PYTHON_VERSION: ${{ matrix.python-version }}
steps:
- name: Checkout WALinuxAgent repo
uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
id: install-dependencies
run: |
sudo env "PATH=$PATH" python -m pip install --upgrade pip
sudo env "PATH=$PATH" pip install -r requirements.txt
sudo env "PATH=$PATH" pip install -r test-requirements.txt
- name: Run pylint
run: |
pylint $PYLINTOPTS --jobs=0 $PYLINTFILES
- name: Test with nosetests
if: success() || (failure() && steps.install-dependencies.outcome == 'success')
run: |
./ci/nosetests.sh
exit $?
- name: Compile Coverage
if: matrix.python-version == 3.9
run: |
echo looking for coverage files :
ls -alh | grep -i coverage
sudo env "PATH=$PATH" coverage combine coverage.*.data
sudo env "PATH=$PATH" coverage xml
sudo env "PATH=$PATH" coverage report
- name: Upload Coverage
if: matrix.python-version == 3.9
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml