-
Notifications
You must be signed in to change notification settings - Fork 4
220 lines (192 loc) · 6.11 KB
/
pr-validate.yml
File metadata and controls
220 lines (192 loc) · 6.11 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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Validate Pull Request
on:
pull_request:
branches: [main]
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: read
jobs:
# Detect docs-only PRs to skip heavy CI (same pattern as hyperlight)
docs-pr:
runs-on: ubuntu-latest
outputs:
docs-only: ${{ steps.docs-only.outputs.result }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 2
- uses: dorny/paths-filter@v4
id: changes
with:
filters: |
docs:
- '**/*.md'
code:
- 'src/**'
- 'plugins/**'
- 'builtin-modules/**'
- 'tests/**'
- 'scripts/**'
- 'skills/**'
- 'patterns/**'
- 'package.json'
- 'package-lock.json'
- 'tsconfig.json'
- 'vitest.config.ts'
- 'Justfile'
- 'Dockerfile'
- '.github/workflows/**'
- uses: actions/github-script@v9
id: docs-only
with:
script: |
return '${{ steps.changes.outputs.code }}' !== 'true';
result-encoding: string
# Lint, typecheck, and unit tests (needs KVM for sandbox tests)
lint-and-test:
name: Lint & Test
needs: [docs-pr]
if: needs.docs-pr.outputs.docs-only != 'true'
runs-on: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd","JobId=hyperagent-pr-validate-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}"]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: "22"
- uses: hyperlight-dev/ci-setup-workflow@v1.9.0
with:
rust-toolchain: "1.89"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install PDF test dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq poppler-utils qpdf fonts-dejavu-core
- name: Setup
run: just setup
- name: Lint (TS + Rust)
run: just lint-all
- name: Test (TS + Rust)
run: just test-all
# Build and test on all hypervisor configurations (1ES runners have Rust + just)
build-and-test:
name: Build & Test (${{ matrix.build }})
needs: [docs-pr]
if: needs.docs-pr.outputs.docs-only != 'true'
strategy:
fail-fast: false
matrix:
build:
- linux-kvm-debug
- linux-kvm-release
- linux-mshv-debug
- linux-mshv-release
- windows-whp-debug
- windows-whp-release
include:
- build: linux-kvm-debug
hypervisor: kvm
config: debug
- build: linux-kvm-release
hypervisor: kvm
config: release
- build: linux-mshv-debug
hypervisor: mshv
config: debug
- build: linux-mshv-release
hypervisor: mshv
config: release
- build: windows-whp-debug
hypervisor: whp
config: debug
- build: windows-whp-release
hypervisor: whp
config: release
runs-on: ${{ fromJson(
format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-amd", "JobId={2}-{3}-{4}-{5}"]',
matrix.hypervisor == 'whp' && 'Windows' || 'Linux',
matrix.hypervisor == 'whp' && 'win2025' || matrix.hypervisor == 'mshv' && 'azlinux3-mshv' || 'kvm',
matrix.build,
github.run_id,
github.run_number,
github.run_attempt)) }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: "22"
- uses: hyperlight-dev/ci-setup-workflow@v1.9.0
with:
rust-toolchain: "1.89"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install PDF test dependencies
if: matrix.hypervisor == 'kvm'
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq poppler-utils qpdf fonts-dejavu-core
- name: Setup
run: just setup
- name: Build binary
run: node scripts/build-binary.js ${{ matrix.config == 'release' && '--release' || '' }}
- name: Run tests
run: just test
- name: Upload binary artifact
if: matrix.config == 'release'
uses: actions/upload-artifact@v7
with:
name: hyperagent-${{ matrix.build }}
path: dist/
retention-days: 7
# Build Docker image (just setup builds deps + creates symlinks for Dockerfile COPY)
build-docker:
name: Build Docker Image
needs: [docs-pr]
if: needs.docs-pr.outputs.docs-only != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: "22"
- uses: hyperlight-dev/ci-setup-workflow@v1.9.0
with:
rust-toolchain: "1.89"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup
run: just setup
- name: Resolve symlinks for Docker context
run: |
if [ -L deps/js-host-api ]; then
target=$(readlink -f deps/js-host-api)
rm deps/js-host-api
cp -r "$target" deps/js-host-api
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build Docker image
uses: docker/build-push-action@v7
with:
context: .
push: false
tags: hyperagent:test
build-args: |
VERSION=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
# Gate PR merges on all jobs passing
ci-status:
name: CI Status
needs: [docs-pr, lint-and-test, build-and-test, build-docker]
if: always()
runs-on: ubuntu-latest
steps:
- name: Check all jobs passed
run: jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJson(needs) }}'