-
Notifications
You must be signed in to change notification settings - Fork 375
154 lines (123 loc) · 4.16 KB
/
ci_pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
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
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