-
Notifications
You must be signed in to change notification settings - Fork 8
130 lines (130 loc) · 4.35 KB
/
ci.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
name: Workflow for Codecov
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
codecov-python-39:
runs-on: windows-latest
env:
PYTHONTRACEMALLOC: 1
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: pip install coverage
- name: Run extension tests
continue-on-error: true
shell: cmd
run: |
cd ./src/extension/tests
echo '===============START EXTENSION TESTS...===============' >> ../../../err.txt
coverage run -m unittest discover -s . -t ../../ 2>> ../../../err.txt
echo '===============FINISH EXTENSION TESTS...===============' >> ../../../err.txt
- name: Run core tests
continue-on-error: true
shell: cmd
run: |
cd ./src/core/tests
echo '===============START CORE TESTS...===============' >> ../../../err.txt
coverage run -m unittest discover -s . -t ../../ 2>> ../../../err.txt
echo '===============FINISH CORE TESTS...===============' >> ../../../err.txt
- name: Collect coverage
run: |
cd ./src/core/tests
coverage xml
cd ../../extension/tests
coverage xml
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
flags: python39
name: python-39
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Read test output and Check if all tests passed
shell: bash
run: |
CONTENTS=$(cat err.txt)
if echo "$CONTENTS" | grep -q 'FAILED (failures='; then
echo "There are failed tests"
echo "Contents: $CONTENTS"
exit 1
fi
codecov-python-27:
runs-on: windows-latest
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
needs: codecov-python-39
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore Python 2.7 cache
uses: actions/cache@v4
with:
path: C:\Python27
key: python27-cache
- name: Install Python 2.7
shell: cmd
run: |
echo "check if python27 is not cached"
if not exist C:\Python27 (
choco install python2 -y
SETX PATH "%PATH%;C:\Python27"
)
- name: Cache dependencies
uses: actions/cache@v4
with:
path: '%UserProfile%\.cache\pip'
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
shell: cmd
run: pip install -r .github/workflows/requirements.txt
- name: Run extension tests
continue-on-error: true
shell: cmd
run: |
cd ./src/extension/tests
echo '===============START EXTENSION TESTS...===============' >> ../../../err2.txt
coverage run -m unittest discover -s . -t ../../ 2>> ../../../err2.txt
echo '===============FINISH EXTENSION TESTS...===============' >> ../../../err2.txt
- name: Run core tests
continue-on-error: true
shell: cmd
run: |
cd ./src/core/tests
echo '===============START CORE TESTS...===============' >> ../../../err2.txt
coverage run -m unittest discover -s . -t ../../ 2>> ../../../err2.txt
echo '===============FINISH CORE TESTS...===============' >> ../../../err2.txt
- name: Collect coverage
run: |
cd ./src/core/tests
coverage xml
cd ../../extension/tests
coverage xml
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
flags: python27
name: python-27
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Read test output and Check if all tests passed
shell: bash
run: |
CONTENTS=$(cat err2.txt)
if echo "$CONTENTS" | grep -q 'FAILED (failures='; then
echo "There are failed tests"
echo "Contents: $CONTENTS"
exit 1
fi