generated from anolilab/monorepo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (82 loc) · 3.43 KB
/
test.yml
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: "Test Packages"
on: # yamllint disable-line rule:truthy
pull_request:
branches:
- "([0-9])?(.{+([0-9]),x}).x"
- "main"
- "next"
- "next-major"
- "alpha"
- "beta"
workflow_dispatch: # yamllint disable-line rule:empty-values
jobs:
test:
name: "tests"
runs-on: "ubuntu-latest"
strategy:
matrix:
os: ["ubuntu-latest"]
node_version: ["16.x", "17.x"]
include:
- os: "macos-latest"
node_version: "16"
- os: "windows-latest"
node_version: "16"
fail-fast: false
steps:
- name: "Git checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 0
persist-credentials: false
env:
GIT_COMMITTER_NAME: "GitHub Actions Shell"
GIT_AUTHOR_NAME: "GitHub Actions Shell"
EMAIL: "github-actions[bot]@users.noreply.github.com"
- name: "Configure Container"
env:
GIT_USER_EMAIL: "${{ secrets.GIT_USER_EMAIL }}"
GIT_USER_USERNAME: "${{ secrets.GIT_USER_USERNAME }}"
run: |
EMAIL=${GIT_USER_EMAIL:-"github-actions[bot]@users.noreply.github.com"}
NAME=${GIT_USER_USERNAME:-"github-actions-shell"}
git config --global user.email "${EMAIL}"
git config --global user.name "${NAME}"
- name: "Use Node.js ${{ matrix.node-version }}"
uses: "actions/setup-node@v2"
with:
node-version: "${{ matrix.node-version }}"
- name: "Install pnpm"
run: "curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@6"
- name: "Cache .pnpm-store"
uses: "actions/cache@v2"
id: "pnpm-cache" # use this to check for `cache-hit` (`steps.pnpm-cache.outputs.cache-hit != 'true'`)
with:
path: "~/.pnpm-store"
key: "${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}"
restore-keys: |
${{ runner.os }}-pnpm-
- name: "Install packages"
run: "pnpm install --frozen-lockfile"
- name: "test and coverage"
run: "pnpm jest --verbose --ci --reporters=default --reporters=jest-junit"
- name: "Upload test results"
if: "success() || failure()"
uses: "actions/upload-artifact@v2"
with:
name: "test-results"
path: "./coverage/junit.xml"
- name: "Create test report"
uses: "dorny/test-reporter@v1"
if: "success() || failure()"
with:
name: "JEST Tests"
path: "./coverage/junit.xml"
reporter: "jest-junit"
- uses: "codecov/codecov-action@v5"
with:
flags: "unittests" # optional
name: "codecov-umbrella" # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)