ci: improve cache (#9860)

This commit is contained in:
三咲智子 2022-09-22 09:04:40 +08:00 committed by GitHub
parent 34dd435534
commit b270dc1296
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 209 additions and 71 deletions

View File

@ -8,9 +8,11 @@ on:
jobs:
result:
runs-on: ubuntu-latest
outputs:
succeeded: ${{ steps.assert.outputs.succeeded }}
pr: ${{ steps.pr.outputs.pr }}
steps:
- name: Download result
uses: dawidd6/action-download-artifact@v2
@ -18,6 +20,7 @@ jobs:
workflow: ${{ github.event.workflow.id }}
run_id: ${{ github.event.workflow_run.id }}
name: commit-lint-result
- name: Derive PR number
uses: dawidd6/action-download-artifact@v2
with:

View File

@ -24,17 +24,18 @@ jobs:
with:
node-version: 16
- name: Cache ~/.pnpm-store
uses: actions/cache@v3
env:
cache-name: cache-pnpm-store
- 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: ~/.pnpm-store
key: ${{ runner.os }}-${{ matrix.node-version }}-test-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-test-${{ env.cache-name }}-
${{ runner.os }}-${{ matrix.node-version }}-test-
${{ runner.os }}-
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i --frozen-lockfile

View File

@ -8,13 +8,19 @@ concurrency:
jobs:
build:
name: Build
name: Build ${{ matrix.os }} ${{ matrix.node-name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [16.x]
node-version: [16, 18]
os: [ubuntu-latest, windows-latest]
include:
- node-version: 16
node-name: LTS
- node-version: 18
node-name: Current
fail-fast: false
env:
@ -31,7 +37,19 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- 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 }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i --frozen-lockfile

View File

@ -10,10 +10,6 @@ jobs:
name: Build Product Check
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v3
with:
@ -29,8 +25,20 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
node-version: 16
- 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 }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i --frozen-lockfile

View File

@ -6,10 +6,6 @@ jobs:
deploy-docs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout
uses: actions/checkout@v3
@ -20,8 +16,20 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
node-version: 16
- 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 }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i --frozen-lockfile
@ -32,7 +40,7 @@ jobs:
CROWDIN_TOKEN: ${{secrets.CROWDIN_TOKEN}}
- name: Pull Crowdin translations
run: cd docs && pnpm exec crowdin download -l es-ES && pnpm exec crowdin download -l zh-CN
run: cd docs && pnpm exec crowdin download -l zh-CN && pnpm exec crowdin download -l es-ES
- name: Generate common locale
run: pnpm docs:gen-locale

View File

@ -10,10 +10,6 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout
uses: actions/checkout@v3
@ -27,8 +23,20 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
node-version: 16
- 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 }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i --frozen-lockfile

View File

@ -11,10 +11,6 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'element-plus' }}
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v3
with:
@ -26,13 +22,27 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
node-version: 16
- 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 }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Lint
run: pnpm lint
- name: Test
run: pnpm test
@ -42,10 +52,12 @@ jobs:
if: ${{ github.repository_owner == 'element-plus' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: https://registry.npmjs.com/
- name: Setup pnpm
uses: pnpm/action-setup@v2

View File

@ -8,10 +8,6 @@ jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v3
with:
@ -25,14 +21,28 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
node-version: 16
registry-url: https://registry.npmjs.com/
cache: 'pnpm'
- 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 }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Lint
run: pnpm lint
- name: Test
run: pnpm test
@ -41,19 +51,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: 16
registry-url: https://registry.npmjs.com/
- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: Get version
run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Get git head
run: echo "GIT_HEAD=${GITHUB_SHA}" >> $GITHUB_ENV
- name: Gen npmrc
run: echo "//registry.npmjs.com/:_authToken=${{ secrets.NPM_PUBLISH_TOKEN }}" >> ./.npmrc
- name: Build&publish
run: sh ./scripts/publish.sh
env:

View File

@ -10,10 +10,6 @@ jobs:
size-report:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
env:
CI_JOB_NUMBER: 1
@ -26,8 +22,20 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
node-version: 16
- 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 }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- uses: preactjs/compressed-size-action@v2
with:

View File

@ -15,10 +15,6 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'element-plus' }}
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout
uses: actions/checkout@v3
@ -29,8 +25,20 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
node-version: 16
- 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 }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i --frozen-lockfile

View File

@ -9,31 +9,41 @@ on:
jobs:
build:
name: Coverage (${{ matrix.node-name }})
name: Coverage
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['16']
include:
- node-version: '16'
node-name: 'Latest'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Add dev branch
run: git branch dev origin/dev
- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
node-version: 16
- 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 }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i --frozen-lockfile
- uses: ArtiomTr/jest-coverage-report-action@v2.0-rc.6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -24,7 +24,19 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'
- 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 }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i --frozen-lockfile

View File

@ -26,7 +26,19 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'
- 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 }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i --frozen-lockfile
@ -40,12 +52,15 @@ jobs:
build:
name: Unit Test (${{ matrix.node-name }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['16']
node-version: [16]
include:
- node-version: '16'
node-name: 'Latest'
- node-version: 16
node-name: LTS
# - node-version: 18
# node-name: Current
steps:
- uses: actions/checkout@v3
@ -57,7 +72,19 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- 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 }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i --frozen-lockfile