-
Notifications
You must be signed in to change notification settings - Fork 4
142 lines (122 loc) · 3.81 KB
/
pr-validate.yml
File metadata and controls
142 lines (122 loc) · 3.81 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
# 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
jobs:
# Basic checks that don't need KVM
lint-and-typecheck:
name: Lint & Typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Patch vscode-jsonrpc
run: node scripts/patch-vscode-jsonrpc.js
- name: Format check
run: npm run fmt:check
- name: Typecheck
run: npm run typecheck
# Build and test on all hypervisor configurations
build-and-test:
name: Build & Test (${{ matrix.hypervisor }}-${{ matrix.config }})
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
os: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"]
hypervisor: kvm
config: debug
- build: linux-kvm-release
os: [self-hosted, Linux, X64, "1ES.Pool=hld-kvm-amd"]
hypervisor: kvm
config: release
- build: linux-mshv-debug
os: [self-hosted, Linux, X64, "1ES.Pool=hld-azlinux3-mshv-amd"]
hypervisor: mshv
config: debug
- build: linux-mshv-release
os: [self-hosted, Linux, X64, "1ES.Pool=hld-azlinux3-mshv-amd"]
hypervisor: mshv
config: release
- build: windows-whp-debug
os: [self-hosted, Windows, X64, "1ES.Pool=hld-win2022-amd"]
hypervisor: whp
config: debug
- build: windows-whp-release
os: [self-hosted, Windows, X64, "1ES.Pool=hld-win2022-amd"]
hypervisor: whp
config: release
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Build binary
run: node scripts/build-binary.js ${{ matrix.config == 'release' && '--release' || '' }}
- name: Run tests
run: npm test
- name: Upload binary artifact
if: matrix.config == 'release'
uses: actions/upload-artifact@v4
with:
name: hyperagent-linux-x64-${{ matrix.hypervisor }}
path: dist/
retention-days: 7
# Build Docker image (doesn't need KVM - just builds)
build-docker:
name: Build Docker Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
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: [lint-and-typecheck, 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) }}'