-
Notifications
You must be signed in to change notification settings - Fork 22
162 lines (140 loc) · 4.22 KB
/
test.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
155
156
157
158
159
160
161
162
name: Test
on:
push:
branches:
- main
paths-ignore:
- "*.md"
- ".vscode/**"
- "docs/**"
- "LICENSE"
pull_request:
branches:
- main
paths-ignore:
- "*.md"
- ".vscode/**"
- "docs/**"
- "LICENSE"
jobs:
test:
name: test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12, windows-latest]
node: [14, 16]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v3
# TODO: ensure that pyright-python uses this node version
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('dev-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Ensure node version
run: |
python .github/scripts/check_node.py '${{ matrix.node }}'
- name: Run tests
run: |
tox -e setup,py,report
lint:
name: lint
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('dev-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Check linters
run: |
tox -e lint
docker:
name: docker
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
docker-platform: [linux/amd64, linux/arm64]
python-os-distro: [slim-bullseye, alpine]
exclude:
# Dockerfile is currently broken for alpine / arm64
# https://github.com/RobertCraigie/pyright-python/issues/123
- docker-platform: linux/arm64
python-os-distro: alpine
# This is currently way too slow, takes ~30 minutes to complete
# TODO: investigate
- docker-platform: linux/arm64
python-os-distro: slim-bullseye
steps:
- uses: actions/checkout@v3
# https://github.com/docker/build-push-action/
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker Build
uses: docker/build-push-action@v3
# https://github.com/docker/build-push-action/#inputs
# Test each platform individually for easier testing
with:
context: .
file: tests/Dockerfile
platforms: "${{ matrix.docker-platform }}"
build-args: OS_DISTRO=${{ matrix.python-os-distro }}
cache-from: type=gha
cache-to: type=gha,mode=max
docker-windows:
name: docker (windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Docker Build
# Use --% to allow double hyphen
# Caching not currently working since we don't use buildx yet, windows
# support seems poor because of interactions with --privileged
# --cache-from=type=gha --cache-to=type=gha,mode=max
run: |
docker build --% -f tests/windows.Dockerfile -t pyright-python .
tests_status:
if: always()
needs:
- test
- lint
- docker
- docker-windows
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}