-
Notifications
You must be signed in to change notification settings - Fork 1.9k
83 lines (70 loc) · 2.22 KB
/
ensure-node-modules-cache.yml
File metadata and controls
83 lines (70 loc) · 2.22 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
name: Ensure node modules cache
on:
push:
branches:
- main
permissions:
contents: read
jobs:
linux:
name: Linux
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-ubuntu-22.04-x64 ]
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
lfs: true
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
- name: Restore build cache
uses: actions/cache@v5
id: build-cache
with:
key: build_cache-${{ hashFiles('build/.cachesalt', 'package-lock.json') }}
path: .build/build_cache
- name: Install dependencies
if: steps.build-cache.outputs.cache-hit != 'true'
run: npm ci
- name: Create build cache archive
if: steps.build-cache.outputs.cache-hit != 'true'
run: |
set -e
mkdir -p .build
node build/listBuildCacheFiles.js .build/build_cache_list.txt
mkdir -p .build/build_cache
tar -czf .build/build_cache/cache.tgz --files-from .build/build_cache_list.txt
windows:
name: Windows
runs-on: [ self-hosted, 1ES.Pool=1es-vscode-windows-2022-x64 ]
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
lfs: true
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22.21.x'
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
architecture: 'x64'
- name: Restore build cache
uses: actions/cache@v5
id: build-cache
with:
key: windows-build_cache-${{ hashFiles('build/.cachesalt', 'package-lock.json') }}
path: .build/build_cache
- name: Install dependencies
if: steps.build-cache.outputs.cache-hit != 'true'
run: npm ci
- name: Create build cache archive
if: steps.build-cache.outputs.cache-hit != 'true'
run: |
mkdir -Force .build
node build/listBuildCacheFiles.js .build/build_cache_list.txt
mkdir -Force .build/build_cache
7z.exe a .build/build_cache/cache.7z -mx3 `@.build/build_cache_list.txt