121 lines (100 loc) · 3.07 KB
/
ci.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: CI
on:
- push
- pull_request
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- name: Skip Duplicate Actions
id: skip_check
uses: fkirc/skip-duplicate-actions@v4.0.0
with:
concurrent_skipping: "same_content"
paths_ignore: '[".vscode/", "**/docs/**", "**/*.md"]'
do_not_skip: '["pull_request"]'
lint:
name: Linting Checks
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup NodeJs
uses: actions/setup-node@v3
with:
node-version: "lts/*"
- run: npm install -g yarn
- run: corepack enable
- name: Install Dependencies
run: yarn install --immutable
- name: Build
run: yarn build
- name: Run Linting Checks
run: yarn lint
- name: Check spelling
run: yarn check-spelling
test:
name: "Test - Node: ${{ matrix.node_version }} - TS: ${{ matrix.ts_version }} - OS: ${{ matrix.os }}"
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
strategy:
fail-fast: false
matrix:
os:
- "ubuntu-latest"
node_version:
- "14"
- "16"
- "18"
ts_version:
- "next"
- "latest"
- "4.4.2"
- "JS"
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.ts_version == 'next' }}
env:
REPORT_COVERAGE: ${{ fromJSON('["false", "true"]')[matrix.ts_version == 'latest' && matrix.node_version == '16' && matrix.os != 'ubuntu-latest'] }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# Fetch all commits for codecov.
fetch-depth: ${{ fromJSON('[0, 1]')[ env.REPORT_COVERAGE == 'true'] }}
- name: Setup NodeJs for building
uses: actions/setup-node@v3
with:
node-version: "16"
- run: npm install -g yarn
- run: corepack enable
- name: Install Dependencies
run: yarn install --immutable
- name: Build
run: yarn build
- name: Compile Tests
if: env.REPORT_COVERAGE == 'false'
run: yarn compile-tests
- name: Setup NodeJs ${{ matrix.node_version }} for testing
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
- run: npm install -g yarn
- run: corepack enable
- name: Remove Dev TypeScript
run: yarn remove typescript
- name: Add TypeScript "${{ matrix.ts_version }}"
if: matrix.ts_version != 'JS'
run: yarn add -D typescript@"${{ matrix.ts_version }}"
- name: Run Tests
run: yarn test
env:
USE_COMPILED_TESTS: ${{ env.REPORT_COVERAGE == 'false' }}
- name: Report coverage
uses: codecov/codecov-action@v3.1.0
if: env.REPORT_COVERAGE == 'true'
with:
file: coverage/lcov.info