-
Notifications
You must be signed in to change notification settings - Fork 5
79 lines (73 loc) · 2 KB
/
build.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
name: build
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile
- name: Lint
run: |
warnings=$(pnpm lint:all 2>&1)
echo "Matrix node version: ${{ matrix.node-version }}"
if [[ "${{ matrix.node-version }}" == "18.x" ]]; then
echo "$warnings"
fi
- name: Format Check
run: |
pnpm prettier:all
pnpm lint:all --fix --quiet
git diff --exit-code -- .
- name: Build - each packages build script
run: |
pnpm build
- name: Build - root tsconfig.json as used by IDE /test code
run: |
# Build the root tsconfig.json, seems to require a prior build step
pnpm tsc -p tsconfig.json --noEmit
- name: Test
run: |
function retry() {
local n=0
local try=$1
local cmd="${@:2}"
[[ $# -le 1 ]] && {
echo "Usage $0 <retry_number> <Command>"
}
until [[ $n -ge $try ]]; do
$cmd && break || {
echo "Command Fail.."
# echo the n++ else the ((n++)) *seems* to be treated as an exit code
# and -u will bail
echo $((n++))
echo "retry $n ::"
sleep 1
}
done
}
retry 3 pnpm cover
env:
CI: true
- name: Report coverage
if: matrix.node-version == '14.x'
run: pnpm codecov
env:
CI: true