Repository navigation
110 lines (89 loc) · 2.96 KB
/
Copy pathcodex-web-setup-test.yml
File metadata and controls
110 lines (89 loc) · 2.96 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
107
108
109
110
name: Codex Web Setup Test
on:
workflow_dispatch:
push:
paths:
- ".codex/codex-web-setup.sh"
- ".github/workflows/codex-web-setup-test.yml"
pull_request:
paths:
- ".codex/codex-web-setup.sh"
- ".github/workflows/codex-web-setup-test.yml"
permissions:
contents: read
jobs:
test-codex-web-setup:
name: Validate codex-web-setup.sh
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Verify shell syntax
shell: bash
run: bash -n .codex/codex-web-setup.sh
- name: Install ShellCheck
shell: bash
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y shellcheck
- name: Run ShellCheck
shell: bash
run: shellcheck .codex/codex-web-setup.sh
- name: Prepare lightweight test harness
shell: bash
run: |
set -euo pipefail
script_bin="${GITHUB_WORKSPACE}/.github/test-bin"
mkdir -p "${script_bin}"
cat > "${script_bin}/sudo" <<'EOF'
#!/usr/bin/env bash
exec "$@"
EOF
chmod +x "${script_bin}/sudo"
cat > "${script_bin}/apt-get" <<'EOF'
#!/usr/bin/env bash
exit 0
EOF
chmod +x "${script_bin}/apt-get"
cat > "${script_bin}/nuget" <<'EOF'
#!/usr/bin/env bash
exit 0
EOF
chmod +x "${script_bin}/nuget"
sdk_version="$(
grep -oE '"version"[[:space:]]*:[[:space:]]*"[^"]+"' "${GITHUB_WORKSPACE}/global.json" |
head -n 1 |
sed -E 's/.*"version"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/'
)"
mkdir -p "${GITHUB_WORKSPACE}/.dotnet-sdk/sdk/${sdk_version}"
cat > "${GITHUB_WORKSPACE}/.dotnet-sdk/dotnet" <<'EOF'
#!/usr/bin/env bash
exit 0
EOF
chmod +x "${GITHUB_WORKSPACE}/.dotnet-sdk/dotnet"
mkdir -p "${HOME}/.dotnet/tools"
cat > "${HOME}/.dotnet/tools/dotnet-coverage" <<'EOF'
#!/usr/bin/env bash
exit 0
EOF
chmod +x "${HOME}/.dotnet/tools/dotnet-coverage"
- name: Execute script and assert expected Linux warning
shell: bash
run: |
set -euo pipefail
export PATH="${GITHUB_WORKSPACE}/.github/test-bin:${PATH}"
bash .codex/codex-web-setup.sh > codex-web-setup.log 2>&1
cat codex-web-setup.log
grep -F "Skipping Windows-only Visual Studio task verification because this host is not Windows." codex-web-setup.log
grep -F "[codex-web-setup] Setup complete." codex-web-setup.log
- name: Upload script log
if: always()
uses: actions/upload-artifact@v4
with:
name: codex-web-setup-log
path: codex-web-setup.log
if-no-files-found: error