29
29
steps :
30
30
- name : Checkout repo
31
31
uses : actions/checkout@v3
32
+ with :
33
+ fetch-depth : 0
34
+ submodules : true
32
35
33
36
- name : Install Node.js v14
34
37
uses : actions/setup-node@v3
@@ -38,21 +41,17 @@ jobs:
38
41
- name : Install helm
39
42
40
43
41
- # NOTE@jsjoeio
42
- # disabling this until we can audit the build process
43
- # and the usefulness of this step
44
- # See: https://github.com/coder/code-server/issues/4287
45
- # - name: Fetch dependencies from cache
46
- # id: cache-yarn
47
- # uses: actions/cache@v2
48
- # with:
49
- # path: "**/node_modules"
50
- # key: yarn-build-${{ hashFiles('**/yarn.lock') }}
51
- # restore-keys: |
52
- # yarn-build-
44
+ - name : Fetch dependencies from cache
45
+ id : cache-yarn
46
+ uses : actions/cache@v3
47
+ with :
48
+ path : " **/node_modules"
49
+ key : yarn-build-${{ hashFiles('**/yarn.lock') }}
50
+ restore-keys : |
51
+ yarn-build-
53
52
54
53
- name : Install dependencies
55
- # if: steps.cache-yarn.outputs.cache-hit != 'true'
54
+ if : steps.cache-yarn.outputs.cache-hit != 'true'
56
55
run : yarn --frozen-lockfile
57
56
58
57
- name : Run yarn fmt
71
70
steps :
72
71
- name : Checkout repo
73
72
uses : actions/checkout@v3
73
+ with :
74
+ fetch-depth : 0
75
+ submodules : true
74
76
75
77
- name : Install Node.js v14
76
78
uses : actions/setup-node@v3
79
81
80
82
- name : Fetch dependencies from cache
81
83
id : cache-yarn
82
- uses : actions/cache@v2
84
+ uses : actions/cache@v3
83
85
with :
84
86
path : " **/node_modules"
85
87
key : yarn-build-${{ hashFiles('**/yarn.lock') }}
@@ -102,60 +104,56 @@ jobs:
102
104
env :
103
105
CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
104
106
steps :
105
- - uses : actions/checkout@v3
107
+ - name : Checkout repo
108
+ uses : actions/checkout@v3
106
109
with :
107
110
fetch-depth : 0
111
+ submodules : true
112
+
113
+ - name : Install quilt
114
+ run : sudo apt update && sudo apt install quilt
115
+
116
+ - name : Patch Code
117
+ run : quilt push -a
108
118
109
119
- name : Install Node.js v14
110
120
uses : actions/setup-node@v3
111
121
with :
112
122
node-version : " 14"
113
123
114
- # TODO@Teffen investigate why this omits code-oss-dev/node_modules
115
- # - name: Fetch dependencies from cache
116
- # id: cache-yarn
117
- # uses: actions/cache@v2
118
- # with:
119
- # path: |
120
- # "**/node_modules"
121
- # "**/vendor/modules"
122
- # "**/vendor/modules/code-oss-dev/node_modules"
123
- # key: yarn-build-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/vendor/yarn.lock') }}
124
- # restore-keys: |
125
- # yarn-build-
124
+ - name : Fetch dependencies from cache
125
+ id : cache-yarn
126
+ uses : actions/cache@v3
127
+ with :
128
+ path : " **/node_modules"
129
+ key : yarn-build-${{ hashFiles('**/yarn.lock') }}
130
+ restore-keys : |
131
+ yarn-build-
126
132
127
133
- name : Install dependencies
128
- # if: steps.cache-yarn.outputs.cache-hit != 'true'
134
+ if : steps.cache-yarn.outputs.cache-hit != 'true'
129
135
run : yarn --frozen-lockfile
130
136
131
137
- name : Build code-server
132
138
run : yarn build
133
139
134
- # Parse the hash of the latest commit inside vendor/modules/code-oss-dev
135
- # use this to avoid rebuilding it if nothing changed
136
- # How it works: the `git log` command fetches the hash of the last commit
137
- # that changed a file inside `vendor/modules/code-oss-dev`. If a commit changes any file in there,
138
- # the hash returned will change, and we rebuild vscode. If the hash did not change,
139
- # (for example, a change to `src/` or `docs/`), we reuse the same build as last time.
140
- # This saves a lot of time in CI, as compiling VSCode can take anywhere from 5-10 minutes.
141
- - name : Get latest vendor/modules/code-oss-dev rev
140
+ # Get Code's git hash. When this changes it means the content is
141
+ # different and we need to rebuild.
142
+ - name : Get latest lib/vscode rev
142
143
id : vscode-rev
143
- run : echo "::set-output name=rev::$(jq -r '.devDependencies["code-oss-dev"]' vendor/package.json | sed -r 's|.*#(.*)$|\1|' )"
144
+ run : echo "::set-output name=rev::$(git rev-parse HEAD:./lib/vscode )"
144
145
145
- - name : Attempt to fetch vscode build from cache
146
- id : cache-vscode-2
147
- uses : actions/cache@v2
146
+ # We need to rebuild when we have a new version of Code or when any of
147
+ # the patches changed. Use VSCODE_CACHE_VERSION to force a rebuild.
148
+ - name : Fetch prebuilt Code package from cache
149
+ id : cache-vscode
150
+ uses : actions/cache@v3
148
151
with :
149
- path : |
150
- vendor/modules/code-oss-dev/.build
151
- vendor/modules/code-oss-dev/package.json
152
- vendor/modules/code-oss-dev/out-build
153
- vendor/modules/code-oss-dev/out-vscode-reh-web
154
- vendor/modules/code-oss-dev/out-vscode-reh-web-min
155
- key : vscode-reh-build-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}
152
+ path : lib/vscode-reh-web-*
153
+ key : vscode-reh-package-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}-${{ hashFiles('patches/*.diff') }}
156
154
157
155
- name : Build vscode
158
- if : steps.cache-vscode-2 .outputs.cache-hit != 'true'
156
+ if : steps.cache-vscode.outputs.cache-hit != 'true'
159
157
run : yarn build:vscode
160
158
161
159
# Our code imports code from VS Code's `out` directory meaning VS Code
@@ -197,9 +195,13 @@ jobs:
197
195
if : github.event.pull_request.head.repo.full_name == github.repository
198
196
runs-on : ubuntu-latest
199
197
steps :
200
- - uses : actions/checkout@v3
198
+ - name : Checkout repo
199
+ uses : actions/checkout@v3
200
+ with :
201
+ fetch-depth : 0
201
202
202
- - uses : actions/download-artifact@v3
203
+ - name : Download artifact
204
+ uses : actions/download-artifact@v3
203
205
id : download
204
206
with :
205
207
name : " npm-package"
@@ -226,7 +228,10 @@ jobs:
226
228
container : " centos:7"
227
229
228
230
steps :
229
- - uses : actions/checkout@v3
231
+ - name : Checkout repo
232
+ uses : actions/checkout@v3
233
+ with :
234
+ fetch-depth : 0
230
235
231
236
- name : Install Node.js v14
232
237
uses : actions/setup-node@v3
@@ -315,7 +320,10 @@ jobs:
315
320
NODE_VERSION : v14.17.4
316
321
317
322
steps :
318
- - uses : actions/checkout@v3
323
+ - name : Checkout repo
324
+ uses : actions/checkout@v3
325
+ with :
326
+ fetch-depth : 0
319
327
320
328
- name : Install Node.js v14
321
329
uses : actions/setup-node@v3
@@ -364,7 +372,10 @@ jobs:
364
372
runs-on : macos-latest
365
373
timeout-minutes : 15
366
374
steps :
367
- - uses : actions/checkout@v3
375
+ - name : Checkout repo
376
+ uses : actions/checkout@v3
377
+ with :
378
+ fetch-depth : 0
368
379
369
380
- name : Install Node.js v14
370
381
uses : actions/setup-node@v3
@@ -409,7 +420,11 @@ jobs:
409
420
# since VS Code will load faster due to the bundling.
410
421
CODE_SERVER_TEST_ENTRY : " ./release-packages/code-server-linux-amd64"
411
422
steps :
412
- - uses : actions/checkout@v3
423
+ - name : Checkout repo
424
+ uses : actions/checkout@v3
425
+ with :
426
+ fetch-depth : 0
427
+ submodules : true
413
428
414
429
- name : Install Node.js v14
415
430
uses : actions/setup-node@v3
@@ -418,7 +433,7 @@ jobs:
418
433
419
434
- name : Fetch dependencies from cache
420
435
id : cache-yarn
421
- uses : actions/cache@v2
436
+ uses : actions/cache@v3
422
437
with :
423
438
path : " **/node_modules"
424
439
key : yarn-build-${{ hashFiles('**/yarn.lock') }}
@@ -446,12 +461,6 @@ jobs:
446
461
./test/node_modules/.bin/playwright install-deps
447
462
./test/node_modules/.bin/playwright install
448
463
449
- # TODO@jsjoeio - remove once we switch to submodules.
450
- - name : Create package.json for testing
451
- run : |
452
- mkdir -p ./vendor/modules/code-oss-dev
453
- echo '{ "version": "test" }' > ./vendor/modules/code-oss-dev/package.json
454
-
455
464
- name : Run end-to-end tests
456
465
run : yarn test:e2e
457
466
@@ -468,8 +477,11 @@ jobs:
468
477
trivy-scan-repo :
469
478
runs-on : ubuntu-20.04
470
479
steps :
471
- - name : Checkout code
480
+ - name : Checkout repo
472
481
uses : actions/checkout@v3
482
+ with :
483
+ fetch-depth : 0
484
+
473
485
- name : Run Trivy vulnerability scanner in repo mode
474
486
uses : aquasecurity/trivy-action@296212627a1e693efa09c00adc3e03b2ba8edf18
475
487
with :
@@ -480,6 +492,7 @@ jobs:
480
492
template : " @/contrib/sarif.tpl"
481
493
output : " trivy-repo-results.sarif"
482
494
severity : " HIGH,CRITICAL"
495
+
483
496
- name : Upload Trivy scan results to GitHub Security tab
484
497
uses : github/codeql-action/upload-sarif@v1
485
498
with :
0 commit comments