-
Notifications
You must be signed in to change notification settings - Fork 38
61 lines (49 loc) · 2.06 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
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Node.js CI
on:
push:
branches: ['main']
pull_request:
branches: ['main']
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# https://stackoverflow.com/questions/61010294/how-to-cache-yarn-packages-in-github-actions
cache: 'yarn'
# https://github.com/kiranojhanp/fullstack-typescript-turborepo-starter/blob/main/.github/workflows/api.yaml
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: yarn install --frozen-lockfile --prefer-offline
- name: Format Check
run: yarn format-check
- name: Lint
run: yarn lint
- name: Type Check
run: yarn type-check
- name: Test
run: yarn test:ci
- name: Coveralls
uses: coverallsapp/github-action@v2
# https://github.com/actions/typescript-action/blob/main/.github/workflows/codeql-analysis.yml
# https://github.com/actions/typescript-action/blob/main/.github/workflows/test.yml