-
Notifications
You must be signed in to change notification settings - Fork 0
227 lines (217 loc) · 7.77 KB
/
Copy pathci.yml
File metadata and controls
227 lines (217 loc) · 7.77 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
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:
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 docker contract
if: >-
vars.WINDOWS_DOCKER_CONTRACT_ENABLED == 'true' &&
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
runs-on:
- self-hosted
- windows
- docker-capable
- private
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
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: |
Copy-Item .env.example $env:TEMP\windows-docker.env
pnpm validate-windows-config -- --config config/windows-runners.yaml --env $env:TEMP\windows-docker.env
pnpm render-windows-compose -- --config config/windows-runners.yaml --env $env:TEMP\windows-docker.env
pnpm render-windows-project-manifest -- --config config/windows-runners.yaml --env $env:TEMP\windows-docker.env
- 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@v6
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@v6
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