Skip to content

Commit 4223cf6

Browse files
authored
refactor(ci): fix fetch-depth and add some caching (#5563)
* refactor: rename ci -> build.yaml * feat: add build.yaml * feat: add node caching to platform jobs * trigger ci
1 parent 987c68a commit 4223cf6

File tree

4 files changed

+44
-32
lines changed

4 files changed

+44
-32
lines changed

.github/workflows/ci.yaml renamed to .github/workflows/build.yaml

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ concurrency:
1818
# Note: if: success() is used in several jobs -
1919
# this ensures that it only executes if all previous jobs succeeded.
2020

21-
# if: steps.cache-yarn.outputs.cache-hit != 'true'
21+
# if: steps.cache-node-modules.outputs.cache-hit != 'true'
2222
# will skip running `yarn install` if it successfully fetched from cache
2323

2424
jobs:
@@ -29,9 +29,6 @@ jobs:
2929
steps:
3030
- name: Checkout repo
3131
uses: actions/checkout@v3
32-
with:
33-
fetch-depth: 0
34-
submodules: true
3532

3633
- name: Install Node.js v16
3734
uses: actions/setup-node@v3
@@ -40,9 +37,14 @@ jobs:
4037

4138
- name: Install helm
4239
uses: azure/[email protected]
40+
with:
41+
token: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Install helm kubeval plugin
44+
run: helm plugin install https://github.com/instrumenta/helm-kubeval
4345

4446
- name: Fetch dependencies from cache
45-
id: cache-yarn
47+
id: cache-node-modules
4648
uses: actions/cache@v3
4749
with:
4850
path: "**/node_modules"
@@ -51,8 +53,8 @@ jobs:
5153
yarn-build-
5254
5355
- name: Install dependencies
54-
if: steps.cache-yarn.outputs.cache-hit != 'true'
55-
run: yarn --frozen-lockfile
56+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
57+
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
5658

5759
- name: Run yarn fmt
5860
run: yarn fmt
@@ -73,11 +75,13 @@ jobs:
7375
- name: Checkout repo
7476
uses: actions/checkout@v3
7577
with:
76-
fetch-depth: 0
7778
submodules: true
7879

7980
- name: Install quilt
80-
run: sudo apt update && sudo apt install quilt
81+
uses: awalsh128/cache-apt-pkgs-action@latest
82+
with:
83+
packages: quilt
84+
version: 1.0
8185

8286
- name: Patch Code
8387
run: quilt push -a
@@ -88,7 +92,7 @@ jobs:
8892
node-version: "16"
8993

9094
- name: Fetch dependencies from cache
91-
id: cache-yarn
95+
id: cache-node-modules
9296
uses: actions/cache@v3
9397
with:
9498
path: "**/node_modules"
@@ -97,7 +101,7 @@ jobs:
97101
yarn-build-
98102
99103
- name: Install dependencies
100-
if: steps.cache-yarn.outputs.cache-hit != 'true'
104+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
101105
run: yarn --frozen-lockfile
102106

103107
- name: Build code-server
@@ -171,8 +175,6 @@ jobs:
171175
steps:
172176
- name: Checkout repo
173177
uses: actions/checkout@v3
174-
with:
175-
fetch-depth: 0
176178

177179
- name: Download artifact
178180
uses: actions/download-artifact@v3
@@ -224,8 +226,6 @@ jobs:
224226
steps:
225227
- name: Checkout repo
226228
uses: actions/checkout@v3
227-
with:
228-
fetch-depth: 0
229229

230230
- name: Install Node.js v16
231231
uses: actions/setup-node@v3
@@ -262,8 +262,18 @@ jobs:
262262
- name: Build standalone release
263263
run: source scl_source enable devtoolset-9 && yarn release:standalone
264264

265+
- name: Fetch dependencies from cache
266+
id: cache-node-modules
267+
uses: actions/cache@v3
268+
with:
269+
path: "**/node_modules"
270+
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
271+
restore-keys: |
272+
yarn-build-
273+
265274
- name: Install test dependencies
266-
run: SKIP_SUBMODULE_DEPS=1 yarn install
275+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
276+
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
267277

268278
- name: Run integration tests on standalone release
269279
run: yarn test:integration
@@ -320,8 +330,6 @@ jobs:
320330
steps:
321331
- name: Checkout repo
322332
uses: actions/checkout@v3
323-
with:
324-
fetch-depth: 0
325333

326334
- name: Install Node.js v16
327335
uses: actions/setup-node@v3
@@ -373,8 +381,6 @@ jobs:
373381
steps:
374382
- name: Checkout repo
375383
uses: actions/checkout@v3
376-
with:
377-
fetch-depth: 0
378384

379385
- name: Install Node.js v16
380386
uses: actions/setup-node@v3
@@ -398,7 +404,17 @@ jobs:
398404
- name: Build standalone release
399405
run: yarn release:standalone
400406

407+
- name: Fetch dependencies from cache
408+
id: cache-node-modules
409+
uses: actions/cache@v3
410+
with:
411+
path: "**/node_modules"
412+
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
413+
restore-keys: |
414+
yarn-build-
415+
401416
- name: Install test dependencies
417+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
402418
run: SKIP_SUBMODULE_DEPS=1 yarn install
403419

404420
- name: Run integration tests on standalone release
@@ -425,16 +441,14 @@ jobs:
425441
steps:
426442
- name: Checkout repo
427443
uses: actions/checkout@v3
428-
with:
429-
fetch-depth: 0
430444

431445
- name: Install Node.js v16
432446
uses: actions/setup-node@v3
433447
with:
434448
node-version: "16"
435449

436450
- name: Fetch dependencies from cache
437-
id: cache-yarn
451+
id: cache-node-modules
438452
uses: actions/cache@v3
439453
with:
440454
path: "**/node_modules"
@@ -455,7 +469,7 @@ jobs:
455469
mv code-server*-linux-amd64 code-server-linux-amd64
456470
457471
- name: Install dependencies
458-
if: steps.cache-yarn.outputs.cache-hit != 'true'
472+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
459473
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
460474

461475
- name: Install Playwright OS dependencies
@@ -488,16 +502,14 @@ jobs:
488502
steps:
489503
- name: Checkout repo
490504
uses: actions/checkout@v3
491-
with:
492-
fetch-depth: 0
493505

494506
- name: Install Node.js v16
495507
uses: actions/setup-node@v3
496508
with:
497509
node-version: "16"
498510

499511
- name: Fetch dependencies from cache
500-
id: cache-yarn
512+
id: cache-node-modules
501513
uses: actions/cache@v3
502514
with:
503515
path: "**/node_modules"
@@ -518,7 +530,7 @@ jobs:
518530
mv code-server*-linux-amd64 code-server-linux-amd64
519531
520532
- name: Install dependencies
521-
if: steps.cache-yarn.outputs.cache-hit != 'true'
533+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
522534
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
523535

524536
- name: Install Playwright OS dependencies

.github/workflows/publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
id: download
3434
with:
3535
branch: release/v${{ steps.version.outputs.version }}
36-
workflow: ci.yaml
36+
workflow: build.yaml
3737
workflow_conclusion: completed
3838
name: "npm-package"
3939
path: release-npm-package

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
id: download
2727
with:
2828
branch: ${{ github.ref }}
29-
workflow: ci.yaml
29+
workflow: build.yaml
3030
workflow_conclusion: completed
3131
check_artifacts: true
3232
name: release-packages

docs/SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ We use the following tools to help us stay on top of vulnerability mitigation.
1616
- [trivy](https://github.com/aquasecurity/trivy)
1717
- Comprehensive vulnerability scanner that runs on PRs into the default
1818
branch and scans both our container image and repository code (see
19-
`trivy-scan-repo` and `trivy-scan-image` jobs in `ci.yaml`)
19+
`trivy-scan-repo` and `trivy-scan-image` jobs in `build.yaml`)
2020
- [`audit-ci`](https://github.com/IBM/audit-ci)
2121
- Audits npm and Yarn dependencies in CI (see `Audit for vulnerabilities` step
22-
in `ci.yaml`) on PRs into the default branch and fails CI if moderate or
22+
in `build.yaml`) on PRs into the default branch and fails CI if moderate or
2323
higher vulnerabilities (see the `audit.sh` script) are present.
2424

2525
## Supported Versions

0 commit comments

Comments
 (0)