forked from microsoft/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 0
192 lines (164 loc) · 7.41 KB
/
nightly-coverage.yml
File metadata and controls
192 lines (164 loc) · 7.41 KB
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: Coverage
on:
schedule:
# Run daily at 2:00 AM
- cron: '0 2 * * *'
env:
NODE_VERSION: 12.15.0
PYTHON_VERSION: 3.9
MOCHA_REPORTER_JUNIT: true # Use the mocha-multi-reporters and send output to both console (spec) and JUnit (mocha-junit-reporter). Also enables a reporter which exits the process running the tests if it haven't already.
ARTIFACT_NAME_VSIX: ms-python-insiders-vsix
VSIX_NAME: ms-python-insiders.vsix
TEST_RESULTS_DIRECTORY: .
jobs:
tests:
name: Tests with Coverage
# The value of runs-on is the OS of the current job (specified in the strategy matrix below) instead of being hardcoded.
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# We're not running CI on macOS for now because it's one less matrix entry to lower the number of runners used,
# macOS runners are expensive, and we assume that Ubuntu is enough to cover the Unix case.
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v2.4.0
with:
node-version: ${{env.NODE_VERSION}}
- name: Install dependencies (npm ci)
run: npm ci
- name: Compile
run: npx gulp prePublishNonBundle
- name: Use Python ${{env.PYTHON_VERSION}}
uses: actions/setup-python@v2
with:
python-version: ${{env.PYTHON_VERSION}}
- name: Install Python requirements
run: |
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt --no-user
# We need to have debugpy so that tests relying on it keep passing, but we don't need install_debugpy's logic in the test phase.
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy
- name: Install test requirements
run: python -m pip install --upgrade -r build/test-requirements.txt
- name: Install functional test requirements
run: python -m pip install --upgrade -r ./build/functional-test-requirements.txt
- name: Prepare pipenv for venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
PYTHON_VIRTUAL_ENVS_LOCATION: './src/tmp/envPaths.json'
shell: pwsh
run: |
python -m pip install pipenv
python -m pipenv run python ./build/ci/addEnvPath.py ${{env.PYTHON_VIRTUAL_ENVS_LOCATION}} pipenvPath
- name: Prepare poetry for venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
shell: pwsh
run: |
python -m pip install poetry
Move-Item -Path ".\build\ci\pyproject.toml" -Destination .
poetry env use python
- name: Prepare virtualenv for venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
PYTHON_VIRTUAL_ENVS_LOCATION: './src/tmp/envPaths.json'
shell: pwsh
run: |
python -m pip install virtualenv
python -m virtualenv .virtualenv/
if ('${{matrix.os}}' -match 'windows-latest') {
& ".virtualenv/Scripts/python.exe" ./build/ci/addEnvPath.py ${{env.PYTHON_VIRTUAL_ENVS_LOCATION}} virtualEnvPath
} else {
& ".virtualenv/bin/python" ./build/ci/addEnvPath.py ${{env.PYTHON_VIRTUAL_ENVS_LOCATION}} virtualEnvPath
}
- name: Prepare venv for venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
PYTHON_VIRTUAL_ENVS_LOCATION: './src/tmp/envPaths.json'
shell: pwsh
run: |
python -m venv .venv
if ('${{matrix.os}}' -match 'windows-latest') {
& ".venv/Scripts/python.exe" ./build/ci/addEnvPath.py ${{env.PYTHON_VIRTUAL_ENVS_LOCATION}} venvPath
} else {
& ".venv/bin/python" ./build/ci/addEnvPath.py ${{env.PYTHON_VIRTUAL_ENVS_LOCATION}} venvPath
}
- name: Prepare conda for venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
PYTHON_VIRTUAL_ENVS_LOCATION: './src/tmp/envPaths.json'
shell: pwsh
run: |
# 1. For `terminalActivation.testvirtualenvs.test.ts`
if ('${{matrix.os}}' -match 'windows-latest') {
$condaPythonPath = Join-Path -Path $Env:CONDA -ChildPath python.exe
$condaExecPath = Join-Path -Path $Env:CONDA -ChildPath Scripts | Join-Path -ChildPath conda
} else{
$condaPythonPath = Join-Path -Path $Env:CONDA -ChildPath bin | Join-Path -ChildPath python
$condaExecPath = Join-Path -Path $Env:CONDA -ChildPath bin | Join-Path -ChildPath conda
}
& $condaPythonPath ./build/ci/addEnvPath.py ${{env.PYTHON_VIRTUAL_ENVS_LOCATION}} condaExecPath $condaExecPath
& $condaPythonPath ./build/ci/addEnvPath.py ${{env.PYTHON_VIRTUAL_ENVS_LOCATION}} condaPath
& $condaExecPath init --all
# 2. For `interpreterLocatorService.testvirtualenvs.ts`
& $condaExecPath create -n "test_env1" -y python
& $condaExecPath create -p "./test_env2" -y python
& $condaExecPath create -p "~/test_env3" -y python
- name: Run TypeScript unit tests
run: npm run test:unittests:cover
- name: Run Python unit tests
run: |
python pythonFiles/tests/run_all.py
# The virtual environment based tests use the `testSingleWorkspace` set of tests
# with the environment variable `TEST_FILES_SUFFIX` set to `testvirtualenvs`,
# which is set in the "Prepare environment for venv tests" step.
# We also use a third-party GitHub Action to install xvfb on Linux,
# run tests and then clean up the process once the tests ran.
# See https://github.com/GabrielBB/xvfb-action
- name: Run venv tests
env:
TEST_FILES_SUFFIX: testvirtualenvs
CI_PYTHON_VERSION: ${{env.PYTHON_VERSION}}
CI_DISABLE_AUTO_SELECTION: 1
uses: GabrielBB/xvfb-action@v1.5
with:
run: npm run testSingleWorkspace:cover
- name: Run single-workspace tests
env:
CI_PYTHON_VERSION: ${{env.PYTHON_VERSION}}
CI_DISABLE_AUTO_SELECTION: 1
uses: GabrielBB/xvfb-action@v1.5
with:
run: npm run testSingleWorkspace:cover
# Enable these tests when coverage is setup for multiroot workspace tests
# - name: Run multi-workspace tests
# env:
# CI_PYTHON_VERSION: ${{env.PYTHON_VERSION}}
# CI_DISABLE_AUTO_SELECTION: 1
# uses: GabrielBB/xvfb-action@v1.5
# with:
# run: npm run testMultiWorkspace:cover
# Enable these tests when coverage is setup for debugger tests
# - name: Run debugger tests
# env:
# CI_PYTHON_VERSION: ${{env.PYTHON_VERSION}}
# CI_DISABLE_AUTO_SELECTION: 1
# uses: GabrielBB/xvfb-action@v1.5
# with:
# run: npm run testDebugger:cover
- name: Run TypeScript functional tests
env:
CI_PYTHON_VERSION: ${{env.PYTHON_VERSION}}
CI_DISABLE_AUTO_SELECTION: 1
run: npm run test:functional:cover
- name: Generate coverage reports
run: npm run test:cover:report
- name: Upload HTML report
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-coverage-report-html
path: ./coverage
retention-days: 1