-
-
Notifications
You must be signed in to change notification settings - Fork 15
509 lines (450 loc) · 19.4 KB
/
debug-matrix.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
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
---
# $schema https://json.schemastore.org/github-workflow.json
# ./.github/workflows/debug-matrix.yaml
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#preinstalled-software
# yamllint disable rule:line-length
name: debug-matrix
on: # yamllint disable-line rule:truthy
# pull_request:
# branches:
# - main
push:
branches:
- main
- master # @TODO remove
paths:
- .github/scripts/debug-*
- .github/workflows/debug-matrix.yaml
workflow_call: # Required so this workflow can be called from another workflow
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
debug-matrix:
runs-on: ${{ matrix.os }}
continue-on-error: true
defaults:
run:
# Docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell
shell: bash --noprofile --norc -e -u -o pipefail -v -x {0}
strategy:
fail-fast: false
max-parallel: 1
# Docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners
matrix:
os:
# https://github.com/actions/runner-images/tree/main#available-images
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
- ubuntu-latest # aka ubuntu-22.04
- windows-latest # aka windows-2022
- macos-latest # aka macos-12
- macos-13 # beta
# is this coming?:
# - macos-13-arm64 # https://github.com/actions/runner-images/blob/main/images/macos/macos-13-arm64-Readme.md
# - ubuntu-20.04
# - windows-2019
# - macos-11
steps:
- name: USES crazy-max/[email protected]
uses: crazy-max/[email protected]
- if: runner.os == 'Linux'
name: List installed apt/snap packages (Linux)
continue-on-error: true
run: |
# bash: List installed apt/snap packages (Linux)
echo "apt --manual-installed:"
apt list --manual-installed | sort
echo "apt list --installed:"
apt list --installed | sort
# echo "apt-mark:"
# apt-mark showmanual
echo "snap list:"
snap list | sort
- if: runner.os == 'macOS'
name: List installed pkgutil/brew packages (macOS)
continue-on-error: true
run: |
# bash: List installed pkgutil/brew packages (macOS)
echo "pkgutil:"
pkgutil --pkgs | sort
echo "brew list:"
brew list --versions | sort || true
- if: runner.os == 'Windows'
name: USES MinoruSekine/setup-scoop@main
uses: MinoruSekine/setup-scoop@main
with:
buckets: extras versions
continue-on-error: true
- if: runner.os == 'Windows'
name: List installed choco/scoop/winget packages (Windows)
shell: cmd
continue-on-error: true
run: |
@rem cmd: List installed choco/scoop/winget packages (Windows)
echo scoop --version:
call scoop --version
echo choco --version:
choco --version
echo winget --version (if installed):
where /q winget && winget --version
echo scoop list:
call scoop list
echo choco list:
choco list --include-programs --yes
@rem main/git main/innounp main/dark main/lessmsi
call scoop install --skip --no-update-scoop main/7zip
call scoop install --skip --no-update-scoop versions/winget-preview
echo winget list:
winget list --disable-interactivity --accept-source-agreements | sort
echo winget --info:
winget --info --disable-interactivity
@rem https://github.com/actions/runner-images/issues/6472#issue-1422886379
@rem yamllint disable rule:line-length
@rem yamllint disable
@rem yamllint disable-line rule:line-length
@rem Invoke-WebRequest -Uri 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx' -OutFile 'VCLibs.appx' | Out-Null # automatically downloads latest version
@rem yamllint disable-line rule:line-length
@rem Invoke-WebRequest -Uri 'https://github.com/microsoft/winget-cli/releases/download/latest/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle' -OutFile 'winget.msixbundle' | Out-Null
@rem yamllint disable-line rule:line-length
@rem $ReleaseInfo = Invoke-RestMethod 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
@rem yamllint disable-line rule:line-length
@rem Invoke-WebRequest -Uri $ReleaseInfo.assets.Where({ $_.name.EndsWith('License1.xml') }).browser_download_url -OutFile 'license.xml' | Out-Null # because the prefix of the file changes with every release
@rem yamllint disable-line rule:line-length
@rem Add-AppxProvisionedPackage -Online -PackagePath winget.msixbundle -LicensePath license.xml -DependencyPackagePath VCLibs.appx | Out-Null
@rem yamllint enable
# - if: false # runner.os == 'Windows'
# shell: powershell
# run: |
# $hasPackageManager = Get-AppPackage -name 'Microsoft.DesktopAppInstaller'
# if (!$hasPackageManager -or [version]$hasPackageManager.Version -lt [version]"1.10.0.0") {
# "Installing winget Dependencies"
# Add-AppxPackage -Path 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx'
# $releases_url = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
# [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# # yamllint disable-line rule:line-length
# $releases = Invoke-RestMethod -uri $releases_url
# $latestRelease = $releases.assets | Where { $_.browser_download_url.EndsWith('msixbundle') } | Select -First 1
# "Installing winget from $($latestRelease.browser_download_url)"
# Add-AppxPackage -Path $latestRelease.browser_download_url
# } else {
# "winget already installed"
# }
# #### Creating settings.json #####
# if ([System.Security.Principal.WindowsIdentity]::GetCurrent().IsSystem) {
# # yamllint disable-line rule:line-length
# $SettingsPath = "$Env:windir\system32\config\systemprofile\AppData\Local\Microsoft\WinGet\Settings\settings.json"
# } else {
# # yamllint disable-line rule:line-length
# $SettingsPath = "$env:LOCALAPPDATA\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json"
# }
# if (Test-Path $SettingsPath) {
# $ConfigFile = Get-Content -Path $SettingsPath | Where-Object {$_ -notmatch '//'} | ConvertFrom-Json
# }
# if (!$ConfigFile){
# $ConfigFile = @{}
# }
# if ($ConfigFile.installBehavior.preferences.scope) {
# $ConfigFile.installBehavior.preferences.scope = "Machine"
# } else {
# Add-Member -InputObject $ConfigFile -MemberType NoteProperty -Name 'installBehavior' -Value $(
# New-Object PSObject -Property $(@{preferences = $(
# New-Object PSObject -Property $(@{scope = "Machine"}))
# })
# ) -Force
# }
# $ConfigFile | ConvertTo-Json | Out-File $SettingsPath -Encoding utf8 -Force
- name: USES actions/checkout
uses: actions/[email protected]
with:
show-progress: false
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell
# - if: contains(fromJSON('["Linux", "macOS"]'), runner.os)
- name: RUN sh ./.github/scripts/debug*.sh
# default: sh -e {0}
shell: sh -e -v -x {0}
continue-on-error: true
run: |
mapfile -t < <(find ./.github/scripts -name 'debug*.sh') || true
for script in "${MAPFILE[@]}"; do
"${script}" "$0" "$@" || true
done
- name: RUN bash ./.github/scripts/debug*.bash
# default: bash --noprofile --norc -eo pipefail {0}
# shell: bash
continue-on-error: true
run: |
mapfile -t < <(find ./.github/scripts -name 'debug*.bash') || true
for script in "${MAPFILE[@]}"; do
"${script}" "$0" "$@" || true
done
- name: RUN bash ./.github/scripts/debug*.bash
# default: bash --noprofile --norc -eo pipefail {0}
shell: bash
continue-on-error: true
run: |
mapfile -t < <(find ./.github/scripts -name 'debug*.bash') || true
for script in "${MAPFILE[@]}"; do
"${script}" "$0" "$@" || true
done
- name: RUN pwsh ./.github/scripts/debug*.ps1
# default: pwsh -command ". '{0}'"
shell: pwsh -Noninteractive -command ". '{0}'"
continue-on-error: true
run: |
Get-ChildItem ".github\scripts\debug*.ps1" | Foreach-Object { & $_.FullName "pwsh" }
Exit 0
- if: runner.os == 'Windows'
name: RUN powershell ./.github/scripts/debug*.ps1 (Windows)
# default: powershell -command ". '{0}'"
shell: powershell -Noninteractive -command ". '{0}'"
continue-on-error: true
run: |
Get-ChildItem ".github\scripts\debug*.ps1" | Foreach-Object { & $_.FullName "powershell" }
Exit 0
- if: runner.os == 'Windows'
name: RUN cmd .github/scripts/debug*.cmd (Windows)
# default: %ComSpec% /D /E:ON /V:OFF /S /C "CALL "{0}""
# /D Ignore registry AutoRun commands
# /E:ON Enable CMD Command Extensions
# /V:OFF Disable delayed environment variable expansion
# /S Strip " quote characters from command.
# /C Run Command and then terminate
shell: 'cmd /D /E:ON /V:ON /S /C "CALL "{0}""'
continue-on-error: true
run: |
for %%A in (.github\scripts\debug*.ps1) do "%%~A" "%~fs0" %*
exit 0
- if: runner.os == 'Linux'
name: RUN list executables (Linux)
continue-on-error: true
run: |
# list executables (Linux)
IFS=: read -r -a paths <<<"${PATH}"
find "${paths[@]}" -maxdepth 1 -type f,l -executable -printf '%P\t%h\n' | \
LC_COLLATE=C sort --ignore-case -u | \
column -ts $'\t' || true
- if: runner.os == 'macOS'
name: RUN list executables (macOS)
continue-on-error: true
run: |
# list executables (macOS)
which bash
which sh
IFS=: read -r -a paths <<<"${PATH}"
find "${paths[@]}" -maxdepth 1 -perm +111 -type f -or -type l -print | \
awk '{b=$0;sub(/\/.*\//,"", b);sub(/\/[a-z]*$/,"",$0);print b "\t" $0}' | \
LC_COLLATE=C sort --ignore-case -u | \
column -ts $'\t' || true
- if: runner.os == 'Windows'
name: RUN list executables (Windows)
shell: bash
continue-on-error: true
run: |
# list executables (Windows)
set -vx
IFS=: read -r -a paths <<<"${PATH}"
find "${paths[@]}" -maxdepth 1 -type f,l -regextype posix-extended -iregex '.*\.(bat|cmd|com|exe)$' -printf '%P\t%h\n' | \
LC_COLLATE=C sort --ignore-case -u | \
column -ts $'\t' || true
- name: RUN python (inline)
# default: python {0}
# note: this is python2 on macos-12
shell: python
continue-on-error: true
run: |
# python (inline)
import os
import pprint
import sys
print("os.name=%s" % os.name)
print("sys.executable=%s" % sys.executable)
print("sys.argv=")
pprint.pprint(sys.argv)
print("sys.version=%s" % sys.version)
print("sys.platform=%s" % sys.platform)
print("os.environ=")
pprint.pprint(dict(os.environ), width=4096)
sys.exit(0)
- # if: runner.os == 'Linux'
name: RUN install pip
continue-on-error: true
run: |
# install pip
set -x
type -P pip >/dev/null && exit 0
PYTHON=$(type -P python3 python py python2 | head -n 1 || true)
# shellcheck disable=SC2139 # This expands when defined, not when used. Consider escaping
alias pip="${PYTHON} -m pip"
sudo=$(type -P sudo || true)
pyversion=$("${PYTHON}" -c 'import sys; print(sys.version_info[0]);')
if command -v apt-get >/dev/null; then
sudo apt-get -qq -y update
if ((pyversion>2)); then
sudo apt-get -qq -y install python3-pip
exit 0
fi
sudo apt-get -qq -y install python-pip
exit 0
fi
GET_PIP_URL==https://bootstrap.pypa.io/pip/2.7/get-pip.py
curl -s -o get-pip.py "${GET_PIP_URL}"
${sudo} "${PYTHON}" get-pip.py
- name: RUN upgrade pip
shell: bash
continue-on-error: true
run: |
# upgrade pip
set -x
PYTHON=$(type -P python3 python py python2 | head -n 1 || true)
if ! type -P pip >/dev/null; then
# shellcheck disable=SC2139 # This expands when defined, not when used. Consider escaping
alias pip="${PYTHON} -m pip"
fi
sudo=$(type -P sudo || true)
${sudo} "${PYTHON}" -m pip install --upgrade pip
- name: RUN pip list
shell: bash
continue-on-error: true
run: |
# pip list
set -x
PYTHON=$(type -P python3 python py python2 | head -n 1 || true)
if ! type -P pip >/dev/null; then
# shellcheck disable=SC2139 # This expands when defined, not when used. Consider escaping
alias pip="${PYTHON} -m pip"
fi
echo "pip list:"
pip list
echo "pip list --outdated:"
pip list --outdated
- name: RUN pip install future
shell: bash
continue-on-error: true
run: |
# pip install future
set -vx
PYTHON=$(type -P python3 python py python2 | head -n 1 || true)
if ! type -P pip >/dev/null; then
# shellcheck disable=SC2139 # This expands when defined, not when used. Consider escaping
alias pip="${PYTHON} -m pip"
fi
sudo=$(type -P sudo || true)
if pip show future >/dev/null; then
exit 0
fi
py_version=$("${PYTHON}" -c 'import sys; print(sys.version_info[0]);')
if command -v apt-get >/dev/null; then
if ((py_version==3)); then
app=python3-future
else
app=python-future
fi
${sudo} apt-get -y install "${app}"
if pip show future >/dev/null; then
exit 0
fi
fi
${sudo} pip --no-python-version-warning --no-input install future
if pip show future >/dev/null; then
exit 0
fi
# --root-user-action=ignore
${sudo} pip install --upgrade setuptools
# https://github.com/PythonCharmers/python-future/issues/604
PYTHON_FUTURE_URL="https://github.com/PythonCharmers/python-future/archive/master.tar.gz"
curl -s "${PYTHON_FUTURE_URL}" | tar xzf -
cd python-future-master/src
${sudo} "${PYTHON}" setup.py install
cd ..
rm -fr python-future-master
pip show future
exit $?
- name: RUN python .github/scripts/debug*.py (via os.system)
# default: python {0}
# note: this is python2 on macos-12
shell: python
continue-on-error: true
run: |
# python .github/scripts/debug*.py (via os.system)
import glob
import os
import sys
scripts = glob.iglob("./.github/scripts/debug*.py")
for script in scripts:
args = [sys.executable, script]
args += sys.argv[:1]
print("Executing %s" % " ".join(args))
os.system(" ".join(args))
sys.exit(0)
- name: RUN python3 (inline)
shell: python3 {0}
continue-on-error: true
run: |
# python3 (inline)
import os
import pprint
import sys
print("os.name=%s" % os.name)
print("sys.executable=%s" % sys.executable)
print("sys.argv=")
pprint.pprint(sys.argv)
print("sys.version=%s" % sys.version)
print("sys.platform=%s" % sys.platform)
print("os.environ=")
pprint.pprint(dict(os.environ), width=4096)
sys.exit(0)
- name: RUN python3 .github/scripts/debug*.py (via subprocess.run)
shell: python3 {0}
continue-on-error: true
run: |
# python3 .github/scripts/debug*.py (via subprocess.run)
import glob
import pprint
import subprocess
import sys
scripts = glob.iglob("./.github/scripts/debug*.py")
for script in scripts:
args = [sys.executable, script]
args += sys.argv[:1]
print("Executing %s" % " ".join(args))
rv = subprocess.run(args)
print("rv=")
pprint.pprint(rv)
sys.exit(0)
- name: RUN python3 .github/scripts/debug*.py (via subprocess.run/shell=true)
shell: python3 {0}
continue-on-error: true
run: |
# python3 .github/scripts/debug*.py (via subprocess.run/shell=true)
import glob
import pprint
import subprocess
import sys
scripts = glob.iglob("./.github/scripts/debug*.py")
for script in scripts:
args = [sys.executable, script]
args += sys.argv[:1]
print("Executing %s" % " ".join(args))
rv = subprocess.run(args, shell=True)
print("rv:")
pprint.pprint(rv)
print('stdout:')
pprint.pprint(rv.stdout)
print('stderr:')
pprint.pprint(rv.stderr)
sys.exit(0)
- name: RUN python .github/scripts/debug-vars.py
shell: python .github/scripts/debug-vars.py {0}
continue-on-error: true
run: |
# shell: python .github/scripts/debug-vars.py {0}
- name: RUN python3 .github/scripts/debug-vars.py
shell: python3 .github/scripts/debug-vars.py {0}
continue-on-error: true
run: |
# shell: python3 .github/scripts/debug-vars.py {0}
# cspell:ignore
# cSpell:ignore bbwe, choco, innounp, iregex, lessmsi, Minoru, msixbundle
# cSpell:ignore Noninteractive, noprofile, norc, pkgs, pyversion, regextype, Sekine
# cSpell:ignore showmanual, wekyb, winget