-
-
Notifications
You must be signed in to change notification settings - Fork 31
140 lines (114 loc) · 3.81 KB
/
main.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: CI
on:
# Trigger the workflow on push or pull request,
# but only for the main branch on Push and any branches on PR
push:
branches:
- main
pull_request:
branches:
- '**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
name: 'Lint on Ubuntu'
runs-on: ubuntu-latest
steps:
- name: Retrieve current Date Time in EST
shell: bash
run: echo "START_TIME=$(TZ=":America/New_York" date -R|sed 's/.....$//')" >> $GITHUB_ENV
- name: Current datetime - ${{ env.START_TIME }}
run: echo ${{ env.START_TIME }}
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm itself
uses: pnpm/action-setup@v3
with:
version: 8
- name: Set NodeJS
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Run pnpm install dependencies
run: pnpm install
- run: pnpm run prettier:check
- run: pnpm run ci:lint
tests:
strategy:
fail-fast: false
matrix:
node: [18, 20, 21]
platform: [ubuntu-latest]
name: 'Run on Ubuntu / Node${{ matrix.node }}'
runs-on: ${{matrix.platform}}
if: ${{ !startsWith(github.event.head_commit.message, 'docs:') }}
steps:
- name: Retrieve current Date Time in EST
shell: bash
run: echo "START_TIME=$(TZ=":America/New_York" date -R|sed 's/.....$//')" >> $GITHUB_ENV
- name: Current datetime - ${{ env.START_TIME }}
run: echo ${{ env.START_TIME }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2 # codecov-bash seems to require this
- name: Install pnpm itself
uses: pnpm/action-setup@v3
with:
version: 8
- name: Set NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
- run: node --version
- run: pnpm --version
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Run pnpm install dependencies
run: pnpm install
- name: Cache TypeScript and Vitest
uses: actions/cache@v4
with:
path: |
packages/*/lib
packages/*/tsconfig.tsbuildinfo
node_modules/.vitest
key: vitest-${{ matrix.platform }}-${{ matrix.node }}-${{ github.run_id }}
restore-keys: vitest-${{ matrix.platform }}-${{ matrix.node }}-
- name: Run all workspace TSC builds
run: pnpm build:full
- name: Run Vitest unit tests
if: |
!contains(github.event.head_commit.message, 'chore(release)')
run: pnpm test:coverage
- name: Upload test coverage to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
if: |
contains(matrix.node, 20) &&
!contains(github.event.head_commit.message, 'chore(release)')