chore: changes the cache location for Puppeteer (#5893)

* chore: changes the cache location for Puppeteer

* fix: ci

* fix: ignore file
This commit is contained in:
ClarkXia 2023-02-13 10:50:52 +08:00 committed by GitHub
parent 34077db7cd
commit 08ef3b745c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 10 deletions

View File

@ -26,14 +26,23 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/
- name: Cache .pnpm-store
id: cache
uses: actions/cache@v1
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Install pnpm
run: npm i pnpm -g
uses: pnpm/action-setup@v2.2.2
with:
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: |
${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
.cache
key: ${{ runner.os }}-pnpm-store-node-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-node-${{ matrix.node-version }}
- run: npm run setup
- run: npm run dependency:check
- run: npm run lint

View File

@ -52,10 +52,12 @@ jobs:
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-node-jest-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
path: |
${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
.cache
key: ${{ runner.os }}-pnpm-store-node-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-node-jest-${{ matrix.node-version }}
${{ runner.os }}-pnpm-store-node-${{ matrix.node-version }}
- run: npm run setup
- run: npm run cov
- name: Upload coverage to Codecov

1
.gitignore vendored
View File

@ -27,6 +27,7 @@ coverage
.happypack
.vscode
.tmp
.cache
*.swp
*.dia~
*.temp.json

9
.puppeteerrc.cjs Normal file
View File

@ -0,0 +1,9 @@
const { join } = require('path');
/**
* @type {import("puppeteer").Configuration}
*/
module.exports = {
// Changes the cache location for Puppeteer.
cacheDirectory: join(__dirname, '.cache', 'puppeteer'),
};