-
Notifications
You must be signed in to change notification settings - Fork 298
129 lines (108 loc) · 3.37 KB
/
ci.yml
File metadata and controls
129 lines (108 loc) · 3.37 KB
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
name: CI
on:
pull_request:
types:
- opened
- reopened
- synchronize
env:
BUILD_CACHE_KEY: ${{ github.sha }}-dist
jobs:
lint:
runs-on: ubuntu-latest
name: ESLint & Prettier
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-node
- run: yarn lint
build:
runs-on: ubuntu-latest
name: Build & Validate
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-node
- run: yarn build
- name: Validate CJS bundle with Node ${{ env.NODE_VERSION }}
run: yarn validate-cjs
- name: Validate translations
run: yarn validate-translations
- name: Cache Build Output
uses: actions/cache@v5
with:
path: ./dist
key: '${{ env.BUILD_CACHE_KEY }}'
test:
runs-on: ubuntu-latest
name: Test
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-node
- name: Test with Node ${{ env.NODE_VERSION }}
run: yarn coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
deploy-vite-example:
permissions:
# contents: write
pull-requests: write
discussions: write
strategy:
matrix:
projects:
- name: Vite Example Development
project-id: prj_2Rq8kuNd0BmqKd2NwvkDjX9Htnx5
stream-api-key: rq7ntdb4zzsq
- name: Vite Example Public
project-id: prj_yBYBe1AJV0tbpTqxCMzcyRfFWXxP
stream-api-key: xzwhhgtazy6h
runs-on: ubuntu-latest
# skip if build fails
needs:
- build
name: Deploy Vite Example to Vercel
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ matrix.projects.project-id }}
VITE_STREAM_API_KEY: ${{ matrix.projects.stream-api-key }}
NODE_ENV: production
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-node
env:
NODE_ENV: ''
- name: Recover Build Output
id: build-cache
uses: actions/cache@v5
with:
path: ./dist
key: '${{ env.BUILD_CACHE_KEY }}'
- name: Build SDK
if: steps.build-cache.outputs.cache-hit != 'true'
run: yarn build
- name: Install example dependencies
working-directory: examples/vite
run: yarn install --frozen-lockfile
shell: bash
- name: Vercel Pull/Build/Deploy (Preview)
working-directory: examples/vite
if: ${{ github.ref_name != 'master' }}
run: >-
npx vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} &&
npx vercel build &&
npx vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > url.txt
- name: Vercel Pull/Build/Deploy (Production)
working-directory: examples/vite
if: ${{ github.ref_name == 'master' }}
run: >-
npx vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} &&
npx vercel build --prod &&
npx vercel deploy --prod --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > url.txt
- name: Add links
uses: ./.github/actions/vercel
env:
GH_TOKEN: ${{ github.token }}
with:
project-directory: examples/vite