-
Notifications
You must be signed in to change notification settings - Fork 2
235 lines (201 loc) · 7.47 KB
/
Copy pathci.yml
File metadata and controls
235 lines (201 loc) · 7.47 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
name: CI
on:
pull_request:
branches:
- main
- dev
push:
branches:
- main
- dev
merge_group:
branches:
- main
- dev
workflow_dispatch:
permissions:
contents: read
jobs:
enforce-main-pr-source:
if: github.event_name == 'pull_request' && github.base_ref == 'main'
runs-on: ubuntu-latest
steps:
- name: Check PR source branch
run: |
if [[ "${{ github.head_ref }}" != "dev" ]]; then
echo "::error::PRs to main MUST come from the dev branch."
echo ""
echo "Blocked PR from '${{ github.head_ref }}' to main."
echo ""
echo "Correct workflow:"
echo " 1. Merge feature work into dev."
echo " 2. Open the release PR from dev to main."
exit 1
fi
echo "PR from dev to main is allowed."
check:
name: check
needs: [enforce-main-pr-source]
if: always() && (needs.enforce-main-pr-source.result == 'success' || needs.enforce-main-pr-source.result == 'skipped')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Provision pinned Ruff proof artifact
run: |
python -m pip install --disable-pip-version-check ruff==0.6.9
test "$(ruff --version)" = "ruff 0.6.9"
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- name: Setup Linux musl toolchain
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Install
run: npm ci
- name: Install authoritative mypy
run: python -m pip install --disable-pip-version-check mypy==2.3.0
- name: Install authoritative Pyright
run: npm install --prefix "${RUNNER_TEMP}/opcore-pyright" --no-package-lock --ignore-scripts pyright@1.1.411
- name: Check
run: npm run ci
- name: Prove authoritative mypy after-state execution
run: npm run python:mypy-authority-proof
env:
OPCORE_REAL_MYPY: ${{ env.pythonLocation }}/bin/mypy
- name: Prove authoritative Pyright after-state execution
run: npm run python:pyright-authority-proof
env:
OPCORE_REAL_PYRIGHT: ${{ runner.temp }}/opcore-pyright/node_modules/.bin/pyright
native-artifact:
name: native-artifact (${{ matrix.target }})
needs: check
if: |
always() &&
needs.check.result == 'success' &&
(
github.ref == 'refs/heads/main' ||
(github.event_name == 'pull_request' && github.base_ref == 'main') ||
(github.event_name == 'merge_group' && (
github.event.merge_group.base_ref == 'main' ||
github.event.merge_group.base_ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/gh-readonly-queue/main/')
))
)
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: linux-x64
runner: ubuntu-latest
rust_target: x86_64-unknown-linux-musl
- target: darwin-x64
runner: macos-15-large
rust_target: x86_64-apple-darwin
- target: darwin-arm64
runner: macos-15-xlarge
rust_target: aarch64-apple-darwin
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust_target }}
- name: Setup Linux musl toolchain
if: matrix.target == 'linux-x64'
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Install
run: npm ci
- name: Build native graph artifact
run: node scripts/build-graph-core-artifact.mjs --target ${{ matrix.target }}
- name: Release dry-run
run: npm run release:dry-run
- name: Archive graph artifacts
run: tar -C packages/opcore-graph-core-${{ matrix.target }} -czf "${RUNNER_TEMP}/opcore-graph-core-${{ matrix.target }}.tgz" .
- name: Upload graph artifacts
uses: actions/upload-artifact@v4
with:
name: opcore-graph-core-${{ matrix.target }}
path: ${{ runner.temp }}/opcore-graph-core-${{ matrix.target }}.tgz
aggregate:
name: aggregate
needs: [check, native-artifact]
if: |
always() &&
needs.check.result == 'success' &&
needs.native-artifact.result == 'success' &&
(
github.ref == 'refs/heads/main' ||
(github.event_name == 'pull_request' && github.base_ref == 'main') ||
(github.event_name == 'merge_group' && (
github.event.merge_group.base_ref == 'main' ||
github.event.merge_group.base_ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/gh-readonly-queue/main/')
))
)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install
run: npm ci
- name: Download darwin arm64 artifact
uses: actions/download-artifact@v4
with:
name: opcore-graph-core-darwin-arm64
path: ${{ runner.temp }}/opcore-graph-core-darwin-arm64
- name: Download darwin x64 artifact
uses: actions/download-artifact@v4
with:
name: opcore-graph-core-darwin-x64
path: ${{ runner.temp }}/opcore-graph-core-darwin-x64
- name: Download linux x64 artifact
uses: actions/download-artifact@v4
with:
name: opcore-graph-core-linux-x64
path: ${{ runner.temp }}/opcore-graph-core-linux-x64
- name: Extract native graph artifacts
run: |
rm -rf packages/opcore-graph-core-darwin-arm64 packages/opcore-graph-core-darwin-x64 packages/opcore-graph-core-linux-x64
mkdir -p packages/opcore-graph-core-darwin-arm64 packages/opcore-graph-core-darwin-x64 packages/opcore-graph-core-linux-x64
tar -xzf "${RUNNER_TEMP}/opcore-graph-core-darwin-arm64/opcore-graph-core-darwin-arm64.tgz" -C packages/opcore-graph-core-darwin-arm64
tar -xzf "${RUNNER_TEMP}/opcore-graph-core-darwin-x64/opcore-graph-core-darwin-x64.tgz" -C packages/opcore-graph-core-darwin-x64
tar -xzf "${RUNNER_TEMP}/opcore-graph-core-linux-x64/opcore-graph-core-linux-x64.tgz" -C packages/opcore-graph-core-linux-x64
- name: Build JS artifacts
run: node node_modules/typescript/bin/tsc -b --pretty false && node scripts/write-cli-descriptor.mjs && node scripts/write-asp-provider-manifest.mjs
- name: Release dry-run
run: npm run release:dry-run
env:
OPCORE_REQUIRE_ALL_NATIVE_PACKAGES: "1"
- name: Pack, release, and cutover checks
run: npm run pack:check && npm run release-receipt:check && npm run cutover:check
env:
OPCORE_REQUIRE_ALL_NATIVE_PACKAGES: "1"
OPCORE_CUTOVER_REUSE_CURRENT_TOOL_GUARDRAILS: "1"