-
Notifications
You must be signed in to change notification settings - Fork 295
165 lines (137 loc) · 5.25 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: CI
on:
workflow_dispatch:
merge_group:
pull_request:
branches:
- build/turbo-ci-poc
env:
NODE_VERSION: '18'
TURBO_CACHE_DIR: ./.turbo-cache
TURBO_CACHE_PREFIX: turbo-
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
formatting-linting:
name: Formatting & Linting
runs-on: ${{ vars.RUNNER_LARGE }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup NodeJS ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Turborepo Remote Server
uses: dtinth/setup-github-actions-caching-for-turbo@v1
with:
cache-prefix: ${{ env.TURBO_CACHE_PREFIX }}
- name: Cache node modules
uses: actions/cache@v3
id: npm-cache
with:
path: ./node_modules
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install NPM Dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci --audit=false --fund=false
- name: Require Changeset
run: if [ "${{ github.event.pull_request.user.login }}" = "clerk-cookie" ]; then echo 'Skipping' && exit 0; else npx changeset status --since=origin/main; fi
- name: Check Formatting
run: npm run format:check
- name: Lint packages using publint
run: npm run lint:publint -- --output-logs=errors-only --cache-dir=${{ env.TURBO_CACHE_DIR }}
- name: Lint types using attw
run: npm run lint:attw -- --output-logs=errors-only --cache-dir=${{ env.TURBO_CACHE_DIR }}
continue-on-error: true # TODO: Remove this when all related errors are fixed
- name: Run lint
run: npm run lint -- --output-logs=errors-only --cache-dir=${{ env.TURBO_CACHE_DIR }} -- --quiet
unit-tests:
name: Unit Tests
needs: formatting-linting
runs-on: ${{ vars.RUNNER_LARGE }}
strategy:
matrix:
node-version: [ 18 ] # [ 18, 19 ]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup NodeJS ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Turborepo Remote Server
uses: dtinth/setup-github-actions-caching-for-turbo@v1
with:
cache-prefix: ${{ env.TURBO_CACHE_PREFIX }}
- name: Cache node modules
uses: actions/cache@v3
id: npm-cache
with:
path: ./node_modules
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install NPM Dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci --audit=false --fund=false
- name: Run tests
run: npm run test:ci -- --output-logs=errors-only --cache-dir=${{ env.TURBO_CACHE_DIR }}
# integration-tests:
# name: Integration Tests
# needs: formatting-linting
# runs-on: ${{ vars.RUNNER_LARGE }}
# strategy:
# matrix:
# test-name: [ 'generic', 'nextjs', 'remix' ]
# services:
# verdaccio:
# image: verdaccio/verdaccio:5
# ports:
# - 4873:4873
# steps:
# - name: Checkout Repo
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
# - name: Setup NodeJS ${{ env.NODE_VERSION }}
# uses: actions/setup-node@v3
# with:
# node-version: ${{ env.NODE_VERSION }}
# cache: "npm"
# - name: Install NPM Dependencies
# run: |
# npm ci --audit=false --fund=false
# npm set @clerk:registry http://localhost:4873/
# - name: Get Playwright Version
# id: playwright-version
# run: echo "VERSION=$(node -e "console.log($(npm ls @playwright/test --json).dependencies['@playwright/test'].version)")" >> "$GITHUB_OUTPUT"
# - name: Cache Playwright Binaries
# uses: actions/cache@v3
# id: playwright-cache
# with:
# path: ~/.cache/ms-playwright
# key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.VERSION }}}}
# - name: Install Playwright Browsers
# if: steps.playwright-cache.outputs.cache-hit != 'true'
# run: npx playwright install --with-deps
# - name: Publish to Verdaccio
# run: npm run release:verdaccio # Fails early if the default npm registry is used
# - name: Install @clerk/backend in /integration
# run: (cd integration && npm init -y && npm install @clerk/backend)
# - name: Run Playwright tests
# run: 'npm run test:integration:${{ matrix.test-name }}'
# env:
# INTEGRATION_INSTANCE_KEYS: ${{ secrets.INTEGRATION_INSTANCE_KEYS }}
# MAILSAC_API_KEY: ${{ secrets.MAILSAC_API_KEY }}
# E2E_CLERK_VERSION: 'latest'
# - name: Upload Playwright Report for ${{ matrix.test-name }}
# uses: actions/upload-artifact@v3
# if: always()
# with:
# name: playwright-report-${{ matrix.test-name }}
# path: playwright-report/
# retention-days: 30