-
Notifications
You must be signed in to change notification settings - Fork 112
136 lines (121 loc) · 4.83 KB
/
Copy pathci.yml
File metadata and controls
136 lines (121 loc) · 4.83 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
130
131
132
133
134
135
136
name: CI
env:
APP_NAME: rtc-node
MACOSX_DEPLOYMENT_TARGET: '10.13'
CARGO_TERM_COLOR: always
permissions:
id-token: write # Required for OIDC
contents: write # Required to create GH releases
pull-requests: write # Required to interact with PRs
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
name: Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0
- name: Use Node.js 24
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24 # NPM v11.5.1 or later is required for OIDC, which ships with node v24
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Lint
run: pnpm lint
- name: Prettier
run: pnpm format:check
reuse:
name: REUSE-3.2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: fsfe/reuse-action@bb774aa972c2a89ff34781233d275075cbddf542 # v5.0.0
test:
name: Test
strategy:
matrix:
node-version: [20, 22, 24, latest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Test build
run: pnpm --filter="*livekit*" run build
- name: Test livekit-server-sdk (Node)
run: pnpm --filter="livekit-server-sdk" test
- name: Test livekit-server-sdk (Browser)
run: pnpm --filter="livekit-server-sdk" test:browser
- name: Test env livekit-server-sdk (Edge Runtime)
run: pnpm --filter="livekit-server-sdk" test:edge
- name: Test rtc-node (Node)
run: pnpm --filter="@livekit/rtc-node" run test
env:
LIVEKIT_URL: ${{ secrets.LIVEKIT_URL }}
LIVEKIT_API_KEY: ${{ secrets.LIVEKIT_API_KEY }}
LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }}
- name: Test server sdk + rtc-node (Bun)
# Run vitest under the bun runtime rather than bun's native test runner.
# `--bun` forces bun to execute vitest (overriding its node shebang), so
# test bodies still run on bun while vitest provides full module mocking
# (vi.mock / vi.spyOn) that bun's native runner lacks.
# EXPECT_BUN_RUNTIME=1 arms a guard test (src/bun_runtime.test.ts) that
# fails if test bodies aren't actually executing on bun — i.e. if the
# `--bun` flag ever stops overriding vitest's node shebang and the job
# silently regresses to running under node.
run: |
bun install
(cd packages/livekit-server-sdk && EXPECT_BUN_RUNTIME=1 bun --bun run test)
(cd packages/livekit-rtc && EXPECT_BUN_RUNTIME=1 bun --bun run test)
build_and_release:
if: github.ref == 'refs/heads/main'
name: Build and release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0
- name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Build server SDK
run: pnpm --filter="livekit-server-sdk" build
- name: Build rtc-node
run: pnpm --filter="@livekit/rtc-node" build
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@6a0a831ff30acef54f2c6aa1cbbc1096b066edaf # v1.7.0
with:
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build Server SDK Docs
if: steps.changesets.outputs.published == 'true'
run: pnpm --filter=livekit-server-sdk build-docs
- name: S3 Upload Server SDK Docs
if: steps.changesets.outputs.published == 'true'
run: aws s3 cp packages/livekit-server-sdk/docs/ s3://livekit-docs/server-sdk-js --recursive
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_DEPLOY_AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_DEPLOY_AWS_API_SECRET }}
AWS_DEFAULT_REGION: 'us-east-1'