-
Notifications
You must be signed in to change notification settings - Fork 21
475 lines (411 loc) · 15.8 KB
/
pr-check.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
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
name: PR/CI Check
on:
pull_request:
branches:
- main
- release*
- release/*
- release-*
push:
branches:
- main
- release*
- release/*
- release-*
jobs:
# tests:
# # Very generic tests, we don't verify whether the envs are discovered correctly or not.
# # However we do ensure that envs that are discovered are valid.
# # See other jobs for specific tests.
# name: Tests
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# include:
# - os: windows-latest
# target: x86_64-pc-windows-msvc
# run_cli: "yes"
# - os: ubuntu-latest
# target: x86_64-unknown-linux-musl
# run_cli: "yes"
# - os: macos-latest
# target: x86_64-apple-darwin
# run_cli: "yes"
# - os: macos-14
# target: aarch64-apple-darwin
# run_cli: "yes"
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Set Python to PATH
# uses: actions/setup-python@v5
# with:
# python-version: "3.x"
# - name: Homebrew Python
# if: startsWith( matrix.os, 'macos')
# run: brew install python
# shell: bash
# - name: Add Conda to PATH
# if: startsWith( matrix.os, 'windows')
# run: |
# $path = $env:PATH + ";" + $env:CONDA + "\condabin"
# echo "PATH=$path" >> $env:GITHUB_ENV
# - name: Add Conda to PATH
# if: startsWith( matrix.os, 'ubuntu')
# run: echo "PATH=$PATH:$CONDA/condabin" >> $GITHUB_ENV
# shell: bash
# - name: Install Conda + add to PATH
# if: startsWith( matrix.os, 'macos')
# run: |
# curl -o ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
# bash ~/miniconda.sh -b -p ~/miniconda
# echo "PATH=$PATH:$HOME/miniconda/bin" >> $GITHUB_ENV
# echo "CONDA=$HOME/miniconda" >> $GITHUB_ENV
# shell: bash
# - name: Check Conda version
# run: conda info --all
# - name: Create Conda Environments
# run: |
# conda create -n test-env1 python=3.12 -y
# conda create -n test-env-no-python -y
# conda create -p ./prefix-envs/.conda1 python=3.12 -y
# conda create -p ./prefix-envs/.conda-nopy -y
# - name: Install pipenv
# run: pip install pipenv
# - name: Check pipenv version
# run: pipenv --version
# - name: Create a Pipenv Environment
# run: pipenv install
# - name: Install virtualenvwrapper
# # Activation of the script doesn't work on mac for some reason (didn't check why yet)
# # But linux is sufficient for the tests
# if: startsWith( matrix.os, 'ubuntu')
# run: |
# pip install virtualenvwrapper
# echo "WORKON_HOME=$HOME/.virtualenvs" >> $GITHUB_ENV
# mkdir -p $HOME/.virtualenvs
# source virtualenvwrapper.sh
# mkvirtualenv venv_wrapper_env1
# shell: bash
# - name: Install virtualenvwrapper-win
# if: startsWith( matrix.os, 'windows')
# run: |
# pip install virtualenvwrapper-win
# echo "WORKON_HOME=$HOME/.virtualenvs" >> $GITHUB_ENV
# shell: bash
# - name: Install pyenv
# if: startsWith( matrix.os, 'windows')
# run: |
# choco install pyenv-win -y
# echo "PATH=$PATH;$HOME/.pyenv/pyenv-win/bin;$HOME/.pyenv/pyenv-win/shims" >> $GITHUB_ENV
# echo "PYENV_ROOT=$HOME/.pyenv" >> $GITHUB_ENV
# shell: bash
# - name: Install pyenv and pyenv-virtualenv
# if: startsWith( matrix.os, 'ubuntu') || startsWith( matrix.os, 'macos')
# run: |
# curl https://pyenv.run | bash
# echo "PYENV_ROOT=$HOME/.pyenv" >> $GITHUB_ENV
# echo "PATH=$HOME/.pyenv/bin:$PATH" >> $GITHUB_ENV
# shell: bash
# - name: Check Pyenv version
# run: pyenv --version
# shell: bash
# - name: Install Pyenv Python(s)
# if: startsWith( matrix.os, 'ubuntu') || startsWith( matrix.os, 'macos')
# run: |
# pyenv install --list
# pyenv install 3.12.4 3.8.19
# shell: bash
# # pyenv-win install list has not updated for a while
# - name: Install Pyenv Python(s)
# if: startsWith( matrix.os, 'windows')
# run: |
# pyenv install --list
# pyenv install 3.10.5 3.8.10
# shell: bash
# - name: Create pyenv-virtualenv envs
# if: startsWith( matrix.os, 'ubuntu') || startsWith( matrix.os, 'macos')
# run: |
# eval "$(pyenv virtualenv-init -)"
# pyenv virtualenv 3.12 pyenv-virtualenv-env1
# shell: bash
# # region venv
# - name: Create .venv
# # if: startsWith( matrix.os, 'ubuntu') || startsWith( matrix.os, 'macos')
# run: |
# python -m venv .venv
# shell: bash
# - name: Create .venv2
# # if: startsWith( matrix.os, 'ubuntu') || startsWith( matrix.os, 'macos')
# run: |
# python -m venv .venv2
# shell: bash
# # endregion venv
# # Rust
# - name: Rust Tool Chain setup
# uses: dtolnay/rust-toolchain@stable
# with:
# toolchain: stable
# targets: ${{ matrix.target }}
# - name: Cargo Fetch
# run: cargo fetch
# shell: bash
# - name: Find Environments
# if: matrix.run_cli == 'yes'
# run: cargo run --release --target ${{ matrix.target }}
# shell: bash
# - name: Run Tests
# # Run integration tests in a single thread,
# # We end up creating conda envs and running multiple tests in parallel
# # that creat conda envs simultaneously causes issues (sometimes the conda envs do not seem to get created)
# # Similar issues were identified in vscode-jupyter tests as well (something to do with conda lock files or the like)
# run: cargo test --frozen --features ci -- --nocapture --test-threads=1
# env:
# RUST_BACKTRACE: 1
# RUST_LOG: trace
# shell: bash
isolated-tests:
# Some of these tests are very specific and need to be run in isolation.
# E.g. we need to ensure we have a poetry project setup correctly (without .venv created using `pip -m venv .venv`).
# We can try to use the previous `tests` job, but that gets very complicated.
name: Env Tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# - feature: ci-poetry-global # Poetry tests with envs stored in standard location
# os: ubuntu-latest
# target: x86_64-unknown-linux-musl
# - feature: ci-poetry-project # Poetry tests, with poetry envs in project
# os: ubuntu-latest
# target: x86_64-unknown-linux-musl
# - feature: ci-poetry-custom # Poetry tests with envs stored in a custom location
# os: ubuntu-latest
# target: x86_64-unknown-linux-musl
- feature: ci-poetry-global # Poetry tests with envs stored in standard location
os: windows-latest
target: x86_64-pc-windows-msvc
# - feature: ci-poetry-project # Poetry tests, with poetry envs in project
# os: windows-latest
# target: x86_64-pc-windows-msvc
# - feature: ci-poetry-custom # Poetry tests with envs stored in a custom location
# os: windows-latest
# target: x86_64-pc-windows-msvc
steps:
- name: Checkout
uses: actions/checkout@v4
# region Setup Poetry
- name: Set Python 3.x to PATH
if: startsWith( matrix.feature, 'ci-poetry')
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Set Python 3.12 to PATH
if: startsWith( matrix.feature, 'ci-poetry')
id: setupPython312
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set Python 3.11 to PATH
if: startsWith( matrix.feature, 'ci-poetry')
id: setupPython311
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Python 3.12 Path
if: startsWith( matrix.feature, 'ci-poetry') && startsWith( matrix.os, 'windows')
run: echo "PYTHON_3_12_PATH=${{ steps.setupPython312.outputs.python-path }}" >> $GITHUB_ENV
shell: bash
- name: Python 3.12 Path
if: startsWith( matrix.feature, 'ci-poetry') && startsWith( matrix.os, 'windows')
run: echo $PYTHON_3_12_PATH
shell: bash
- name: Python 3.11 Path
if: startsWith( matrix.feature, 'ci-poetry') && startsWith( matrix.os, 'windows')
run: echo "PYTHON_3_11_PATH=${{ steps.setupPython311.outputs.python-path }}" >> $GITHUB_ENV
shell: bash
- name: Install Poetry (envs globally)
if: startsWith( matrix.feature, 'ci-poetry-global')
uses: snok/install-poetry@93ada01c735cc8a383ce0ce2ae205a21c415379b
with:
virtualenvs-create: true
virtualenvs-in-project: false
installer-parallel: true
- name: Install Poetry (env locally)
if: startsWith( matrix.feature, 'ci-poetry-project')
uses: snok/install-poetry@93ada01c735cc8a383ce0ce2ae205a21c415379b
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install Poetry (env locally)
if: startsWith( matrix.feature, 'ci-poetry-custom')
uses: snok/install-poetry@93ada01c735cc8a383ce0ce2ae205a21c415379b
with:
virtualenvs-create: true
virtualenvs-in-project: false
virtualenvs-path: ~/my-custom-path
installer-parallel: true
- name: Petry exe
if: startsWith( matrix.feature, 'ci-poetry')
run: which poetry
shell: bash
- name: Petry config
if: startsWith( matrix.feature, 'ci-poetry')
run: poetry config --list
shell: bash
- name: Petry setup
if: startsWith( matrix.feature, 'ci-poetry')
# We want to have 2 envs for this poetry project 3.12 and 3.11.
run: poetry init --name=pet-test --python=^3.11 -q -n
shell: bash
- name: Petry virtual env setup 3.12
if: startsWith( matrix.feature, 'ci-poetry') && startsWith( matrix.os, 'ubuntu')
run: poetry env use 3.12
shell: bash
- name: Petry virtual env setup 3.12
if: startsWith( matrix.feature, 'ci-poetry') && startsWith( matrix.os, 'windows')
run: poetry env use $PYTHON_3_12_PATH
shell: bash
- name: Petry virtual env setup 3.11
if: startsWith( matrix.feature, 'ci-poetry') && startsWith( matrix.os, 'ubuntu')
run: poetry env use 3.11
shell: bash
- name: Petry virtual env setup 3.11
if: startsWith( matrix.feature, 'ci-poetry') && startsWith( matrix.os, 'windows')
run: poetry env use $PYTHON_3_11_PATH
shell: bash
- name: Petry list envs
if: startsWith( matrix.feature, 'ci-poetry')
run: poetry env list
shell: bash
- name: Petry pyproject.toml
if: startsWith( matrix.feature, 'ci-poetry')
run: cat pyproject.toml
shell: bash
# # Dump env vars
# - name: Env
# run: set
# shell: bash
# endregion
# Rust
- name: Rust Tool Chain setup
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Cargo Fetch
run: cargo fetch
shell: bash
- name: Find Environments
run: cargo run --release --target ${{ matrix.target }}
shell: bash
- name: Run Tests
# Run integration tests in a single thread,
# We end up creating conda envs and running multiple tests in parallel
# that creat conda envs simultaneously causes issues (sometimes the conda envs do not seem to get created)
# Similar issues were identified in vscode-jupyter tests as well (something to do with conda lock files or the like)
run: cargo test --frozen --features ${{ matrix.feature }} -- --nocapture --test-threads=1
env:
RUST_BACKTRACE: 1
RUST_LOG: trace
shell: bash
# container-tests:
# # These tests are required as its not easy/possible to use the previous jobs.
# # E.g. we need to test against the jupyter container, as we found some issues specific to that env.
# name: Tests in Containers
# container:
# image: ${{ matrix.image }}
# options: --user=root
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# include:
# - feature: ci-jupyter-container
# os: ubuntu-latest
# # For Tests again the container used in https://github.com/github/codespaces-jupyter
# image: mcr.microsoft.com/devcontainers/universal:2.11.1
# target: x86_64-unknown-linux-musl
# - feature: ci-homebrew-container
# os: ubuntu-latest
# # For Homebrew in Ubuntu
# image: homebrew/brew
# target: x86_64-unknown-linux-musl
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# # Homebrew
# - name: Homebrew Python
# if: startsWith( matrix.image, 'homebrew')
# run: brew install [email protected] [email protected]
# shell: bash
# # Rust
# - name: Rust Tool Chain setup
# uses: dtolnay/rust-toolchain@stable
# with:
# toolchain: stable
# targets: ${{ matrix.target }}
# - name: Cargo Fetch
# run: cargo fetch
# shell: bash
# - name: Find Environments
# run: cargo run --release --target ${{ matrix.target }}
# shell: bash
# - name: Run Tests
# run: cargo test --frozen --features ${{ matrix.feature }} -- --nocapture
# shell: bash
# builds:
# name: Builds
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# include:
# - os: windows-latest
# target: x86_64-pc-windows-msvc
# - os: windows-latest
# target: aarch64-pc-windows-msvc
# - os: ubuntu-latest
# target: x86_64-unknown-linux-musl
# run_cli: "yes"
# # - os: ubuntu-latest
# # target: aarch64-unknown-linux-gnu
# # - os: ubuntu-latest
# # target: arm-unknown-linux-gnueabihf
# - os: macos-latest
# target: x86_64-apple-darwin
# run_cli: "yes"
# - os: macos-14
# target: aarch64-apple-darwin
# run_cli: "yes"
# # - os: ubuntu-latest
# # target: x86_64-unknown-linux-gnu
# # - os: ubuntu-latest
# # target: aarch64-unknown-linux-musl
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Rust Tool Chain setup
# uses: dtolnay/rust-toolchain@stable
# with:
# toolchain: stable
# targets: ${{ matrix.target }}
# - name: Cargo Fetch
# run: cargo fetch
# shell: bash
# - name: Run Tests
# # We do not want to run all features, CI is only for tests with Python
# # Thats a separate job.
# run: cargo test --frozen
# shell: bash
# - name: Build
# run: cargo build --release --target ${{ matrix.target }}
# shell: bash
# - name: Upload Artifact
# uses: actions/upload-artifact@v4
# with:
# name: pet-${{ matrix.target }}
# path: target/${{ matrix.target }}/release/pet*