-
Notifications
You must be signed in to change notification settings - Fork 21
124 lines (96 loc) · 3.54 KB
/
validation.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
name: 'Validation'
env:
PYTHON_VERSION: 3.11
on:
pull_request:
branches: [main]
jobs:
static_checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./pw pdm use ${{ env.PYTHON_VERSION }} --first
# need to use pw script at least once even when activating the context so that the wrapper installs pyprojectx
- run: ./pw pdm lock --check
- name: activate pyprojectx context
run: realpath ./.pyprojectx/main >> $GITHUB_PATH
- run: pdm install
- name: typescript typecheck
run: pdm run npx lerna exec --stream --no-bail -- tsc --noEmit
- run: pdm run npm run check
- name: python typecheck
run: pdm run typecheck
- name: ruff check
run: pdm run ruff check --output-format github
- name: ruff format
run: pdm run ruff format --check --diff
- name: pylint
run: pdm run pylint
tests:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
name: Test ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Use Python ${{env.PYTHON_VERSION}}
uses: actions/setup-python@v5
id: install_python
with:
python-version: ${{env.PYTHON_VERSION}}
- run: ./pw pdm install
# using relative path for npm scripts because it needs to work in the package directories too
- name: add pyprojectx and npm scripts to PATH (linux)
if: runner.os != 'Windows'
run: |
realpath ./.pyprojectx/main >> $GITHUB_PATH
echo ./node_modules/.bin >> $GITHUB_PATH
- name: add pyprojectx and npm scripts to PATH (windows)
if: runner.os == 'Windows'
run: |
echo (resolve-path "./.pyprojectx/main").path | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "./node_modules/.bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: python tests
run: pdm run test_python -- -m "not needs_all_docstubs"
- name: npm test (pyright-internal)
run: npm test
working-directory: packages/pyright-internal
- name: Create Venv
run: |
${{ steps.install_python.outputs.python-path }} -m venv .venv
- name: Activate and install pytest (linux)
if: runner.os != 'Windows'
run: |
source .venv/bin/activate
python -m pip install pytest
python -c "import sys;print('python_venv_path=' + sys.executable)" >> $GITHUB_ENV
- name: Activate and install pytest (windows)
if: runner.os == 'Windows'
run: |
.venv\scripts\activate
python -m pip install pytest
python -c "import sys;print('python_venv_path=' + sys.executable)" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Echo python_venv_path
run: |
echo python_venv_path=${{env.python_venv_path}}
- name: Run import tests with venv
env:
CI_IMPORT_TEST_VENVPATH: '../../'
CI_IMPORT_TEST_VENV: '.venv'
run: npm run test:imports
working-directory: packages/pyright-internal
- name: Run import tests with pythonpath
env:
CI_IMPORT_TEST_PYTHONPATH: ${{env.python_venv_path}}
run: npm run test:imports
working-directory: packages/pyright-internal
required:
runs-on: ubuntu-latest
name: Required
needs:
- static_checks
- tests
steps:
- run: echo All required jobs succeeded.