element-plus/.github/workflows/unit-test.yml

52 lines
1.4 KiB
YAML
Raw Normal View History

name: Unit Test
2020-07-25 23:38:24 +08:00
2020-09-01 13:27:19 +08:00
on: pull_request
2020-07-25 23:38:24 +08:00
jobs:
build:
2021-09-08 21:42:17 +08:00
name: Unit Test (${{ matrix.node-name }})
2020-07-25 23:38:24 +08:00
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['16']
2021-09-08 21:42:17 +08:00
include:
- node-version: '16'
2021-09-08 21:42:17 +08:00
node-name: 'Latest'
2020-07-25 23:38:24 +08:00
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Add dev branch
run: git branch dev origin/dev
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
2021-10-16 20:58:41 +08:00
version: latest
2020-08-03 18:07:29 +08:00
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
2022-02-21 16:11:17 +08:00
- name: Cache ~/.pnpm-store
uses: actions/cache@v2
env:
cache-name: cache-pnpm-store
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ matrix.node-version }}-test-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-test-${{ env.cache-name }}-
${{ runner.os }}-${{ matrix.node-version }}-test-
${{ runner.os }}-
2020-08-03 18:07:29 +08:00
- name: Install dependencies
2021-10-16 20:58:41 +08:00
run: pnpm i --frozen-lockfile
2020-08-04 10:49:49 +08:00
- name: Lint
run: pnpm lint
- name: Test
2022-02-22 15:28:02 +08:00
run: pnpm test:jest && pnpm test:coverage
- name: Upload to codecov.io
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true