-
Notifications
You must be signed in to change notification settings - Fork 298
199 lines (193 loc) · 7.17 KB
/
ci.yml
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
name: ci
on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:
jobs:
test-unit:
strategy:
fail-fast: false
matrix:
runner: [ubuntu, windows, macos]
# Run on the most recently supported version of node for all bots.
node: [20]
include:
# Additionally, run the oldest supported version on Ubuntu. We don't
# need to run this on all platforms as we're only verifying we don't
# call any APIs not available in this version.
- runner: ubuntu
node: 16 # Supported by VS Code 1.81 (July 2023).
runs-on: ${{ matrix.runner }}-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # SECURITY: pin third-party action hashes
- run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
shell: bash
id: pnpm-cache
- name: Cache pnpm store
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-${{ matrix.node }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-${{ matrix.node }}-pnpm-store-
- run: pnpm install
- run: pnpm build
- run: pnpm run test:unit --run
env:
CODY_NODE_VERSION: ${{ matrix.node }}
test-integration:
strategy:
fail-fast: false
matrix:
runner: [ubuntu, windows, macos]
runs-on: ${{ matrix.runner }}-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .tool-versions
- uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # SECURITY: pin third-party action hashes
- run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
shell: bash
id: pnpm-cache
- name: Cache pnpm store
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-store-
- run: pnpm install
- run: xvfb-run -a pnpm -C vscode run test:integration
if: matrix.runner == 'ubuntu'
- run: pnpm -C vscode run test:integration
if: github.ref == 'refs/heads/main' && (matrix.runner == 'windows' || matrix.runner == 'macos')
test-e2e:
strategy:
fail-fast: false
matrix:
include:
# only shard ubuntu
- runner: windows
- runner: ubuntu
shard: 1/5
- runner: ubuntu
shard: 2/5
- runner: ubuntu
shard: 3/5
- runner: ubuntu
shard: 4/5
- runner: ubuntu
shard: 5/5
runs-on: ${{ matrix.runner }}-latest
timeout-minutes: 15
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .tool-versions
- uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # SECURITY: pin third-party action hashes
- id: auth
uses: google-github-actions/auth@v0
# Skip auth if PR is from a fork
if: ${{ !github.event.pull_request.head.repo.fork }}
with:
workload_identity_provider: ${{ secrets.DATA_TEAM_PROVIDER_NAME }}
service_account: ${{ secrets.DATA_TEAM_SA_EMAIL }}
- uses: google-github-actions/setup-gcloud@v0
- run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
shell: bash
id: pnpm-cache
- name: Cache pnpm store
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-store-
- run: pnpm install
- run: xvfb-run -a pnpm -C vscode run test:e2e --shard=${{ matrix.shard }}
if: matrix.runner == 'ubuntu'
- run: pnpm -C vscode run test:e2e
if: matrix.runner != 'ubuntu'
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: playwright-recordings ${{ matrix.runner }}
path: playwright/**/*.webm
# Use a single large mac for e2e tests as it runs in 4m instead of 6m (as of
# 2023-12-06)
#
# fixme(toolmantim): We should dedupe this Mac job with the above job using a
# matrix after Cody 1.0.0. It wasn't done beforehand because it requires
# updating the required status checks for merging PRs. Ideally it would just
# be https://github.com/sourcegraph/cody/blob/21a40be7297da70f310350e2557a069ea06326ce/.github/workflows/ci.yml#L76
test-e2e-macos:
runs-on: macos-latest-large
name: 'test-e2e (macos)'
timeout-minutes: 15
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .tool-versions
- uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # SECURITY: pin third-party action hashes
- id: auth
uses: google-github-actions/auth@v0
# Skip auth if PR is from a fork
if: ${{ !github.event.pull_request.head.repo.fork }}
with:
workload_identity_provider: ${{ secrets.DATA_TEAM_PROVIDER_NAME }}
service_account: ${{ secrets.DATA_TEAM_SA_EMAIL }}
- uses: google-github-actions/setup-gcloud@v0
- run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
shell: bash
id: pnpm-cache
- name: Cache pnpm store
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-store-
- run: pnpm install
- run: pnpm -C vscode run test:e2e
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: playwright-recordings ${{ matrix.runner }}
path: playwright/**/*.webm
build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .tool-versions
- uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # SECURITY: pin third-party action hashes
- run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
shell: bash
id: pnpm-cache
- name: Cache pnpm store
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-store-
- run: pnpm install
- run: pnpm exec biome ci --error-on-warnings .
- run: pnpm run build
- run: pnpm -C vscode run build
- run: CODY_RELEASE_TYPE=stable pnpm -C vscode run release:dry-run