-
Notifications
You must be signed in to change notification settings - Fork 0
279 lines (265 loc) · 9.39 KB
/
Copy pathci.yml
File metadata and controls
279 lines (265 loc) · 9.39 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
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
name: CI
on:
push:
branches:
- main
- master
- "jmcte/**"
pull_request:
workflow_dispatch:
permissions:
contents: read
env:
SHELL: /bin/bash
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
reusable_contract_changes:
name: reusable workflow smoke scope
if: github.event_name == 'pull_request'
runs-on: ubuntu-24.04
outputs:
changed: ${{ steps.filter.outputs.changed }}
steps:
- uses: actions/checkout@v7
- uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4
id: filter
with:
filters: |
changed:
- '.github/workflows/rg-ci.yml'
- '.github/workflows/rg-security.yml'
- '.github/workflows/rg-release.yml'
- '.github/workflows/reusable-workflow-smoke.yml'
- 'test/reusable-workflow-contract.test.ts'
- 'test/fixtures/reusable-workflow.Dockerfile'
reusable_ci_smoke:
name: reusable rg-ci caller smoke
needs: reusable_contract_changes
if: needs.reusable_contract_changes.outputs.changed == 'true'
uses: ./.github/workflows/rg-ci.yml
with:
runner-class: hosted
reusable_security_smoke:
name: reusable rg-security caller smoke
needs: reusable_contract_changes
if: needs.reusable_contract_changes.outputs.changed == 'true'
permissions:
contents: read
actions: read
pull-requests: read
security-events: write
uses: ./.github/workflows/rg-security.yml
with:
enable-dependency-review: false
enforce-osv: false
reusable_release_smoke:
name: reusable rg-release caller smoke
needs: reusable_contract_changes
if: needs.reusable_contract_changes.outputs.changed == 'true'
permissions:
contents: read
packages: write
id-token: write
attestations: write
uses: ./.github/workflows/rg-release.yml
with:
image-ref: local/reusable-workflow-smoke:${{ github.sha }}
dockerfile: test/fixtures/reusable-workflow.Dockerfile
platforms: linux/amd64
publish: false
test_self_hosted_trusted:
name: test
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on:
- self-hosted
- linux
- shell-only
- public
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- uses: ./actions/setup-shell-safe-node
with:
node-version: 24.14.1
- uses: pnpm/action-setup@v6
with:
version: 10.32.1
- run: pnpm install --frozen-lockfile
- run: pnpm lint
- run: pnpm test:coverage
- run: pnpm build
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: coverage/**
if-no-files-found: error
shell_safe_contract_trusted:
name: shell-safe contract
if: >-
vars.SHELL_SAFE_CONTRACT_ENABLED == 'true' &&
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
runs-on:
- self-hosted
- synology
- shell-only
- public
env:
RUNNER_TEMP: /tmp/github-runner-temp
RUNNER_TOOL_CACHE: /opt/hostedtoolcache
AGENT_TOOLSDIRECTORY: /opt/hostedtoolcache
TF_PLUGIN_CACHE_DIR: /tmp/github-runner-temp/terraform-plugin-cache
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- name: Prepare shell-safe cache directories
run: |
mkdir -p \
"$RUNNER_TEMP" \
"$RUNNER_TOOL_CACHE" \
"$TF_PLUGIN_CACHE_DIR" \
.tmp/ci-shell-safe/npm \
.tmp/ci-shell-safe/pip \
.tmp/ci-shell-safe/terraform
- uses: actions/cache@v6
with:
path: |
.tmp/ci-shell-safe/npm
.tmp/ci-shell-safe/pip
${{ env.TF_PLUGIN_CACHE_DIR }}
key: ${{ runner.os }}-shell-safe-contract-${{ hashFiles('docker/Dockerfile', '.github/workflows/ci.yml') }}
- name: Verify built-in shell-safe toolchain
run: |
bash --version | head -n 1
git --version
tar --version | head -n 1
zstd --version | head -n 1
node --version
npm --version
python3.12 --version
python --version
terraform version
- name: Verify cache-aware commands
env:
npm_config_cache: ${{ github.workspace }}/.tmp/ci-shell-safe/npm
PIP_CACHE_DIR: ${{ github.workspace }}/.tmp/ci-shell-safe/pip
run: |
python3.12 -m venv .venv-contract
source .venv-contract/bin/activate
python -m pip install --upgrade pip setuptools wheel
python -m pip cache dir
npm config get cache
cat > .tmp/ci-shell-safe/terraform/main.tf <<'EOF'
terraform {
required_version = "= 1.6.6"
}
EOF
terraform -chdir=.tmp/ci-shell-safe/terraform init -backend=false
linux_docker_contract_trusted:
name: linux docker contract
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on:
- self-hosted
- linux
- shell-only
- public
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
- uses: ./actions/setup-shell-safe-node
with:
node-version: 24.14.1
- uses: pnpm/action-setup@v6
with:
version: 10.32.1
- run: pnpm install --frozen-lockfile
- name: Render Linux Docker runner manifests
run: |
cp .env.example /tmp/linux-docker.env
pnpm validate-linux-docker-config -- --config config/linux-docker-runners.yaml --env /tmp/linux-docker.env
pnpm render-linux-docker-compose -- --config config/linux-docker-runners.yaml --env /tmp/linux-docker.env
pnpm render-linux-docker-project-manifest -- --config config/linux-docker-runners.yaml --env /tmp/linux-docker.env
windows_contract_trusted:
name: windows template contract
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: "24"
- uses: pnpm/action-setup@v6
with:
version: 10.32.1
- run: pnpm install --frozen-lockfile
- name: Render Windows Docker runner manifests
shell: pwsh
run: |
$windowsEnv = Join-Path $env:RUNNER_TEMP "windows-docker.env"
Copy-Item .env.example $windowsEnv
pnpm validate-windows-config -- --config config/windows-runners.yaml --env $windowsEnv
pnpm render-windows-compose -- --config config/windows-runners.yaml --env $windowsEnv
pnpm render-windows-project-manifest -- --config config/windows-runners.yaml --env $windowsEnv
- name: Validate Windows entrypoint syntax
shell: pwsh
run: |
$parseErrors = $null
$null = [System.Management.Automation.PSParser]::Tokenize((Get-Content docker/runner-entrypoint.ps1 -Raw), [ref]$parseErrors)
if ($parseErrors) { throw ($parseErrors | Out-String) }
lume_macos_contract_trusted:
name: lume macos contract
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: "24"
- uses: pnpm/action-setup@v6
with:
version: 10.32.1
- run: pnpm install --frozen-lockfile
- run: pnpm lint
- run: pnpm test
- run: pnpm build
- name: Render Lume runner manifest
run: |
cp .env.example /tmp/lume.env
pnpm validate-lume-config -- --config config/lume-runners.yaml --env /tmp/lume.env
pnpm render-lume-runner-manifest -- --config config/lume-runners.yaml --env /tmp/lume.env --slot 1
- name: Exercise Lume project lifecycle
run: |
pnpm install-lume-project -- --lume-config config/lume-runners.yaml --env /tmp/lume.env --format json --status-output /tmp/lume-project-result.json --dry-run
pnpm teardown-lume-project -- --lume-config config/lume-runners.yaml --env /tmp/lume.env --format json --status-output /tmp/lume-project-result.json --dry-run
- name: Validate Lume shell scripts
run: |
bash -n scripts/lib/github-runner-common.sh
bash -n scripts/guest/macos-runner-bootstrap.sh
bash -n scripts/lume/lib.sh
bash -n scripts/lume/create-base-vm.sh
bash -n scripts/lume/create-slot.sh
bash -n scripts/lume/destroy-slot.sh
bash -n scripts/lume/run-slot.sh
bash -n scripts/lume/reconcile-pool.sh
bash -n scripts/lume/status.sh
test_public_fork_pr:
name: test
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: "24"
- uses: pnpm/action-setup@v6
with:
version: 10.32.1
- run: pnpm install --frozen-lockfile
- run: pnpm lint
- run: pnpm test
- run: pnpm build