-
Notifications
You must be signed in to change notification settings - Fork 0
381 lines (323 loc) · 13.9 KB
/
regression_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
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
name: Regression Tests
on:
push:
paths-ignore:
# Ignore updates to just the publish action
- '.github/workflows/publish.yml'
# Ignore updates to just version files for Origen/OM/CLI
- 'rust/origen/cli/Cargo.toml'
- 'python/origen/pyproject.toml'
- 'python/origen_metal/pyproject.toml'
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(vars.SUPPORTED_OS) }}
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS) }}
runs-on: ${{ matrix.os }}
env:
RUST_BACKTRACE: full
steps:
- uses: actions/checkout@v3
- name: Show Git Version
run : |
git --version
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ fromJSON(vars.RUST_VERSION) }}
rustflags:
- name: Override Project Rust Version
run: rustup override set ${{ fromJSON(vars.RUST_VERSION) }}
- name: Check Rust Version
run: |
rustc --version
cargo --version
# TODO Invocations: Currently some problem with poetry/pip on Windows where dependencies on drives/mounts separate
# from where the pyproject is located cannot be built. Can workaround this in Windows by updating the
# AGENT_TOOLSDIRECTORY/RUNNER_TOOL_CACHE environment variables, but I'm unable to get these to stick across steps
# in GA. Next few steps are all messiness to debug/work around that.
# Not an issue in Linux, so Windows only will be moved. linux will maintained across different drives.
- name: Pre-Python Install Setup (Windows-Only)
if: matrix.os == 'windows-latest'
run: |
$env:RUNNER_TOOL_CACHE = '${{ github.workspace }}' | Split-Path | Join-Path -ChildPath o2_GA_tools
$env:AGENT_TOOLSDIRECTORY = $env:RUNNER_TOOL_CACHE
mkdir $env:RUNNER_TOOL_CACHE
echo $env:AGENT_TOOLSDIRECTORY
echo $env:RUNNER_TOOL_CACHE
ls $env:AGENT_TOOLSDIRECTORY
echo "RUNNER_TOOL_CACHE=$env:RUNNER_TOOL_CACHE"
echo "AGENT_TOOLSDIRECTORY=$env:AGENT_TOOLSDIRECTORY"
echo "RUNNER_TOOL_CACHE=$env:RUNNER_TOOL_CACHE" >> $GITHUB_ENV
echo "AGENT_TOOLSDIRECTORY=$env:AGENT_TOOLSDIRECTORY" >> $GITHUB_ENV
- name: Check ENV Variables (Windows-Only)
if: matrix.os == 'windows-latest'
run: |
echo $env:AGENT_TOOLSDIRECTORY
echo $env:RUNNER_TOOL_CACHE
echo $RUNNER_TOOL_CACHE
echo $AGENT_TOOLSDIRECTORY
- name: Setup Python ${{ matrix.python-version }}
if: matrix.os != 'windows-latest'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup Python ${{ matrix.python-version }}
if: matrix.os == 'windows-latest'
uses: actions/setup-python@v4
env:
RUNNER_TOOL_CACHE: D:\a\o2\o2_GA_tools
AGENT_TOOLSDIRECTORY: D:\a\o2\o2_GA_tools
with:
python-version: ${{ matrix.python-version }}
- name: Check Python Install (Windows-Only)
if: matrix.os == 'windows-latest'
run: |
echo $RUNNER_TOOL_CACHE
echo $AGENT_TOOLSDIRECTORY
echo $env:AGENT_TOOLSDIRECTORY
echo $env:RUNNER_TOOL_CACHE
ls $env:AGENT_TOOLSDIRECTORY
python -c "import os; [print(f'{v}: {k}') for v,k in os.environ.items()];"
python -c "import os, sys; print(os.path.dirname(sys.executable))"
# Needed to compile keyring library
# Install taken from keyring library:
# https://github.com/hwchen/keyring-rs/blob/v0.10.1/.github/workflows/ci.yaml#L80-L84
- name: install libdbus
run: |
sudo apt update
sudo apt install libdbus-1-dev
if: contains(matrix.os, 'ubuntu')
- name: Build Origen CLI
working-directory: rust/origen/cli
run: cargo build --bins
- name: Add Origen to PATH (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
echo "${{ github.workspace }}/rust/origen/target/debug" >> $GITHUB_PATH
export PATH="${{ github.workspace }}/rust/origen/target/debug:$PATH"
- name: Add Origen to PATH (Windows)
if: matrix.os == 'windows-latest'
run: |
echo "${{ github.workspace }}/rust/origen/target/debug" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
$env:Path = "${{ github.workspace }}/rust/origen/target/debug;$env:Path"
- name: Display Python Version
run: |
python -c "import sys; print(sys.version)"
pip --version
- name: Display Origen CLI Version
run: origen -v
- name: Build PyAPI
run: origen origen build
- name: Setup App Env
working-directory: test_apps/python_app
run: origen env setup
- name: Display Origen App Version
working-directory: test_apps/python_app
run: origen -v
- name: Show Origen Binary Location (Linux)
if: matrix.os == 'ubuntu-latest'
run: which origen
- name: Show Origen Binary Location (Windows)
if: matrix.os == 'windows-latest'
run: where.exe origen
- name: Display Poetry Version
working-directory: test_apps/python_app
run: poetry --version
# - name: Install importlib_metadata (Python 3.12)
# run: pip install importlib_metadata
# - name: Cache Poetry Version (Linux)
# if: matrix.os == 'ubuntu-latest'
# working-directory: test_apps/python_app
# run: |
# POETRY_VER=$(python -c "import importlib_metadata; print(importlib_metadata.version('poetry'))")
# echo $POETRY_VER
# echo "poetry_version=$POETRY_VER" >> $GITHUB_ENV
# - name: Cache Poetry Version (Windows)
# if: matrix.os == 'windows-latest'
# working-directory: test_apps/python_app
# run: |
# $POETRY_VER = python -c "import importlib_metadata; print(importlib_metadata.version('poetry'))"
# echo $POETRY_VER
# echo "poetry_version=$POETRY_VER" >> $GITHUB_ENV
- name: Show Origen Binary Location (Linux)
if: matrix.os == 'ubuntu-latest'
working-directory: test_apps/python_app
run: |
which origen
poetry run which origen
- name: Show Origen Binary Location (Windows)
if: matrix.os == 'windows-latest'
working-directory: test_apps/python_app
run: |
where.exe origen
echo ""
poetry run where.exe origen
# TODO GA: Add to build script?
- name: Move Origen executable (Linux)
if: matrix.os == 'ubuntu-latest'
run: cp rust/origen/target/debug/origen python/origen/origen/__bin__/bin
- name: Move Origen executable (Windows)
if: matrix.os == 'windows-latest'
run: cp rust/origen/target/debug/origen.exe python/origen/origen/__bin__/bin
- name: Show Origen Binary Location (Linux)
if: matrix.os == 'ubuntu-latest'
working-directory: test_apps/python_app
run: |
which origen
poetry run which origen
- name: Show Origen Binary Location (Windows)
if: matrix.os == 'windows-latest'
working-directory: test_apps/python_app
run: |
where.exe origen
echo ""
poetry run where.exe origen
- name: Run Python-App Unit Tests
uses: Wandalen/wretry.action@v1.3.0
with:
attempt_limit: 2
current_path: test_apps/python_app
command: origen exec pytest -vv
- name: Run Python-App Diff Tests
working-directory: test_apps/python_app
run: origen examples
- name: Setup No-App Env
uses: Wandalen/wretry.action@v1.3.0
with:
attempt_limit: 2
current_path: test_apps/python_no_app
command: poetry install
- name: Display Poetry Version (No-App)
working-directory: test_apps/python_no_app
run: poetry --version
# Copy _origen
- name: Copy Origen Library (Windows)
if: matrix.os == 'windows-latest'
working-directory: .\rust\pyapi\
run: cp .\target\debug\_origen.dll ..\..\python\origen\_origen.pyd
# Copy _origen
- name: Copy Origen Library (Linux)
if: matrix.os == 'ubuntu-latest'
working-directory: rust/pyapi
run: cp target/debug/lib_origen.so ../../python/origen/_origen.so
# Debug
- name: Display python/origen directory
working-directory: test_apps/python_no_app
run: ls ../../python/origen
- name: Show Origen Binary Location (Linux)
if: matrix.os == 'ubuntu-latest'
working-directory: test_apps/python_no_app
run: |
which origen
poetry run which origen
- name: Show Origen Binary Location (Windows)
if: matrix.os == 'windows-latest'
working-directory: test_apps/python_no_app
run: |
where.exe origen
echo ""
poetry run where.exe origen
- name: Display Origen No-App Version
working-directory: test_apps/python_no_app
run: poetry run origen -vvv
- name: Run Python-No-App Unit Tests
working-directory: test_apps/python_no_app
run: poetry run pytest -vv
- name: Run Rust Tests
if: matrix.python-version == 3.8
working-directory: rust/origen
run: cargo test --workspace
- name: Build PyAPI - Metal
run: origen origen build --metal
- name: Setup Python Env - Metal
working-directory: python/origen_metal
run: poetry install
- name: Run Python Unit Tests - Metal
working-directory: python/origen_metal
run: poetry run pytest -vv
- name: Run Rust Tests - Metal
working-directory: rust/origen_metal
run: cargo test
# Use a global pytest install for invocation tests
- name: Install Pytest
run: pip install pytest==7.2.1 jinja2==3.1.2
- name: Get Pytest Version (Check Install)
run: pytest --version
# - name: Run User-Global Invocation Tests
# working-directory: test_apps/no_workspace
# run: pytest test_user_install.py::TestUserInstall -vv
# TODO GA: Regressions: eventually want to move this into a poetry build step
# For now, manually move the binary. Also keeps us from having to mess with the path across OSs
# 'mv' command should be be fine for both linux & powershell
# Update: remove binary since it is being copied earlier.
- name: Remove Origen executable (Linux)
if: matrix.os == 'ubuntu-latest'
run: rm rust/origen/target/debug/origen
# run: rm rust/origen/target/debug/origen python/origen/origen/__bin__/bin
- name: Remove Origen executable (Windows)
if: matrix.os == 'windows-latest'
run: rm rust/origen/target/debug/origen.exe
# run: rm rust/origen/target/debug/origen.exe python/origen/origen/__bin__/bin
# TODO GA: Regressions: not sure why, but the tmp directory in origen_metal causes some issues
# For now, just removing it.
- name: Remove origen_metal tmp Directory
run: rm python/origen_metal/tmp -r
# TODO GA: Regressions: Need to better handle this
# Issue being that working on a newer Python version than what's released will not resolve
# Workaround by removing origen_metal package from origen dependencies and installing separately
- name: Hack origen pyproject
working-directory: python/origen
run: poetry remove origen_metal
- name: Install Origen Packages
run: |
pip --version
poetry --version
pip install python/origen
pip install python/origen_metal
- name: Show Origen Binary Location (Linux)
if: matrix.os == 'ubuntu-latest'
run: which origen
- name: Show Origen Binary Location (Windows)
if: matrix.os == 'windows-latest'
run: where.exe origen
# - name: Reinstall Poetry Version
# run: |
# echo ${{ env.poetry_version }}
# poetry --version
# pip install poetry==${{ env.poetry_version }}
# poetry --version
- name: Run User-Global Invocation Tests
working-directory: test_apps/no_workspace
run: pytest test_user_install.py::TestUserInstall -vv
# Should be no pyprojects in the root so far. Start with no-workspace tests
- name: Run No-Workspace-No-Plugins Tests
working-directory: test_apps/no_workspace
run: pytest test_no_workspace.py::TestNoWorkspaceNoPlugins -vv
- name: Install Plugins
run: |
pip install test_apps/test_apps_shared_test_helpers
pip install test_apps/python_plugin
pip install python/origen_metal
- name: Run No-Workspace-With-Plugins Tests
working-directory: test_apps/no_workspace
run: pytest test_no_workspace.py::TestNoWorkspaceWithPlugins -vv
# Leave the no-workspace setup. The global setup should override
- name: Run Global No-Plugins One Above Site-Packages Dir
working-directory: test_apps/no_workspace
run: pytest test_global_install.py::TestGlobalInstallNoPlugins -vv
- name: Run Global With Plugins At Site-Packages Dir
working-directory: test_apps/no_workspace
run: pytest test_global_install.py::TestGlobalInstallWithPlugins -vv
- name: Run Global No-Plugins At CLI Dir
working-directory: test_apps/no_workspace
run: pytest test_global_install.py::TestGlobalInstallAtCliDir -vv
# With global origen available, test user install errors which fall back to the global install
- name: Run User Install Errors - Falling Back To Global Install
working-directory: test_apps/no_workspace
run:
poetry --version
pytest test_user_install.py::TestErrorCasesWithFallback -vv