add cache
This commit is contained in:
parent
78ba01d3a0
commit
2089830d92
4 changed files with 73 additions and 1 deletions
16
.github/workflows/linux.yml
vendored
16
.github/workflows/linux.yml
vendored
|
@ -54,6 +54,22 @@ jobs:
|
|||
run: ./check_tags.sh
|
||||
if: env.SHOULD_DEPLOY == 'yes'
|
||||
|
||||
- name: Compute cache key
|
||||
id: yarnCacheKey
|
||||
run: echo "::set-output name=value::$(node build/azure-pipelines/computeYarnCacheKey.js)"
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarnCacheDirPath
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
|
||||
- name: Cache yarn directory
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.yarnCacheDirPath.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarnCacheDir-${{ steps.yarnCacheKey.outputs.value }}
|
||||
restore-keys: ${{ runner.os }}-yarnCacheDir-
|
||||
if: env.SHOULD_BUILD == 'yes'
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
18
.github/workflows/macos.yml
vendored
18
.github/workflows/macos.yml
vendored
|
@ -35,7 +35,23 @@ jobs:
|
|||
run: |
|
||||
. check_tags.sh
|
||||
if: env.SHOULD_DEPLOY == 'yes'
|
||||
|
||||
|
||||
- name: Compute cache key
|
||||
id: yarnCacheKey
|
||||
run: echo "::set-output name=value::$(node build/azure-pipelines/computeYarnCacheKey.js)"
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarnCacheDirPath
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
|
||||
- name: Cache yarn directory
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.yarnCacheDirPath.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarnCacheDir-${{ steps.yarnCacheKey.outputs.value }}
|
||||
restore-keys: ${{ runner.os }}-yarnCacheDir-
|
||||
if: env.SHOULD_BUILD == 'yes'
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
16
.github/workflows/windows.yml
vendored
16
.github/workflows/windows.yml
vendored
|
@ -49,6 +49,22 @@ jobs:
|
|||
shell: bash
|
||||
if: env.SHOULD_DEPLOY == 'yes'
|
||||
|
||||
- name: Compute cache key
|
||||
id: yarnCacheKey
|
||||
run: echo "::set-output name=value::$(node build/azure-pipelines/computeYarnCacheKey.js)"
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarnCacheDirPath
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
|
||||
- name: Cache yarn directory
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.yarnCacheDirPath.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarnCacheDir-${{ steps.yarnCacheKey.outputs.value }}
|
||||
restore-keys: ${{ runner.os }}-yarnCacheDir-
|
||||
if: env.SHOULD_BUILD == 'yes'
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
24
build/azure-pipelines/computeYarnCacheKey.js
Normal file
24
build/azure-pipelines/computeYarnCacheKey.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
const fs = require("fs");
|
||||
const crypto = require("crypto");
|
||||
const path = require("path");
|
||||
const { dirs } = require('../../vscode/build/npm/dirs');
|
||||
|
||||
const ROOT = path.join(__dirname, '../../vscode');
|
||||
|
||||
const shasum = crypto.createHash('sha1');
|
||||
|
||||
shasum.update(fs.readFileSync(path.join(ROOT, '.yarnrc')));
|
||||
shasum.update(fs.readFileSync(path.join(ROOT, 'remote/.yarnrc')));
|
||||
|
||||
// Add `yarn.lock` files
|
||||
for (let dir of dirs) {
|
||||
const yarnLockPath = path.join(ROOT, dir, 'yarn.lock');
|
||||
shasum.update(fs.readFileSync(yarnLockPath));
|
||||
}
|
||||
|
||||
// Add any other command line arguments
|
||||
for (let i = 2; i < process.argv.length; i++) {
|
||||
shasum.update(process.argv[i]);
|
||||
}
|
||||
|
||||
process.stdout.write(shasum.digest('hex'));
|
Loading…
Add table
Reference in a new issue