Add lock around access to fast_track.json #3173
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
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" | |
- 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 | |
env: | |
NOSEOPTS: "--with-timer ${{ matrix.additional-nose-opts }}" | |
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 | |
sudo env "PATH=$PATH" pip install --upgrade pylint | |
- name: Run pylint | |
run: | | |
# | |
# List of files/directories to be checked by pylint. | |
# The end-to-end tests run only on Python 3.9 and we lint them only on that version. | |
# | |
PYLINT_FILES="azurelinuxagent setup.py makepkg.py tests" | |
if [[ "${{ matrix.python-version }}" == "3.9" ]]; then | |
PYLINT_FILES="$PYLINT_FILES tests_e2e" | |
fi | |
# | |
# Command-line options for pylint. | |
# * "unused-private-member" is not implemented on 3.5 and will produce "E0012: Bad option value 'unused-private-member' (bad-option-value)" | |
# so we suppress "bad-option-value". | |
# * 3.9 will produce "no-member" for several properties/methods that are added to the mocks used by the unit tests (e.g | |
# "E1101: Instance of 'WireProtocol' has no 'aggregate_status' member") so we suppress that warning. | |
# * On 3.9 pylint crashes when parsing azurelinuxagent/daemon/main.py (see https://github.com/pylint-dev/pylint/issues/9473), so we ignore it. | |
# * 'no-self-use' ("R0201: Method could be a function") was moved to an optional extension on 3.8 and is no longer used by default. It needs | |
# to be suppressed for previous versions (3.0-3.7), though. | |
# | |
PYLINT_OPTIONS="--rcfile=ci/pylintrc --jobs=0" | |
if [[ "${{ matrix.python-version }}" == "3.5" ]]; then | |
PYLINT_OPTIONS="$PYLINT_OPTIONS --disable=bad-option-value" | |
fi | |
if [[ "${{ matrix.python-version }}" == "3.9" ]]; then | |
PYLINT_OPTIONS="$PYLINT_OPTIONS --disable=no-member --ignore=main.py" | |
fi | |
if [[ "${{ matrix.python-version }}" =~ ^3\.[0-7]$ ]]; then | |
PYLINT_OPTIONS="$PYLINT_OPTIONS --disable=no-self-use" | |
fi | |
echo "PYLINT_OPTIONS: $PYLINT_OPTIONS" | |
echo "PYLINT_FILES: $PYLINT_FILES" | |
pylint $PYLINT_OPTIONS $PYLINT_FILES | |
- name: Test with nosetests | |
if: contains(fromJSON('["3.10", "3.11"]'), matrix.python-version) == false && (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 |