-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (86 loc) · 2.66 KB
/
Copy pathscript-validation.yml
File metadata and controls
106 lines (86 loc) · 2.66 KB
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
name: Script Validation
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: script-validation-${{ github.ref }}
cancel-in-progress: true
jobs:
powershell:
name: PowerShell validation
runs-on: windows-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Validate PowerShell syntax
shell: pwsh
run: ./scripts/powershell/Test-ScriptSyntax.ps1 -Path ./scripts
- name: Install PSScriptAnalyzer
shell: pwsh
run: |
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
foreach ($attempt in 1..3) {
try {
Install-Module -Name PSScriptAnalyzer -Scope CurrentUser -Force -ErrorAction Stop
break
} catch {
if ($attempt -eq 3) {
throw
}
Write-Warning "PSScriptAnalyzer installation attempt $attempt failed. Retrying..."
Start-Sleep -Seconds 10
}
}
- name: Run PSScriptAnalyzer
shell: pwsh
run: |
$results = Invoke-ScriptAnalyzer -Path ./scripts -Recurse -Settings ./PSScriptAnalyzerSettings.psd1
$results | Format-Table -AutoSize
if ($results) {
exit 1
}
- name: Run Codex Workspace Doctor smoke test
shell: pwsh
run: ./scripts/tests/Test-Optimize-CodexWorkspace.ps1
bash:
name: Bash validation
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Validate shell syntax
run: |
set -euo pipefail
find scripts -name "*.sh" -print0 | xargs -0 -n1 bash -n
- name: Install ShellCheck
run: |
sudo apt-get update -y
sudo apt-get install -y shellcheck
- name: Run ShellCheck
run: |
set -euo pipefail
find scripts -name "*.sh" -print0 | xargs -0 shellcheck --severity=error
- name: Run Linux safety tests
run: bash scripts/tests/test-linux-safety.sh
python:
name: Python validation
runs-on: windows-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Validate Python syntax
run: python -m py_compile scripts/python/codex_cost_router.py scripts/python/mcp_server.py
- name: Run Python tests
run: python -m unittest discover -s scripts/python/tests -v