Repository navigation
139 lines (115 loc) · 4.59 KB
/
Copy pathci.yml
File metadata and controls
139 lines (115 loc) · 4.59 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
137
138
139
name: CI
on:
push:
branches: [dev]
pull_request:
branches: [dev, production]
jobs:
typecheck-test-build:
runs-on: ubuntu-latest
# Databases for the store packages' conformance tests. Locally those tests
# skip unless the CHATCOPS_TEST_* variables below are set.
services:
redis:
image: redis:7-alpine
ports: ['6379:6379']
options: >-
--health-cmd "redis-cli ping" --health-interval 5s --health-timeout 3s --health-retries 10
# The Upstash REST API in front of the redis service, for @upstash/redis.
upstash:
image: hiett/serverless-redis-http:0.0.10
ports: ['8079:80']
env:
SRH_MODE: env
SRH_TOKEN: chatcops_test_token
SRH_CONNECTION_STRING: redis://redis:6379
postgres:
image: postgres:17-alpine
ports: ['5432:5432']
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd "pg_isready -U postgres" --health-interval 5s --health-timeout 3s --health-retries 10
env:
CHATCOPS_TEST_REDIS_URL: redis://localhost:6379
CHATCOPS_TEST_UPSTASH_URL: http://localhost:8079
CHATCOPS_TEST_UPSTASH_TOKEN: chatcops_test_token
CHATCOPS_TEST_POSTGRES_URL: postgres://postgres:postgres@localhost:5432/postgres
steps:
- uses: actions/checkout@v4
# Some editors save files with a UTF-8 BOM, and a tool that reads UTF-8 with
# the wrong encoding turns a dash or an arrow into two or three other
# characters. Both have reached PRs here, so catch them before review.
- name: No BOM or garbled characters
run: |
if git grep -n -I -F -e $'\xEF\xBB\xBF' -e $'\xCE\x93\xC3\x87' -e $'\xCE\x93\xC3\xA5\xC3\x86' \
-e $'\xE2\x94\xAC\xE2\x95\x96' -e $'\xC3\xA2\xE2\x82\xAC' -e $'\xC3\x83\xC2\xA9'; then
echo "::error::The lines above start with a UTF-8 BOM or have text garbled by the wrong encoding. Save the file as UTF-8 without a BOM, and copy garbled lines back from the base branch."
exit 1
fi
# Recorded provider responses are replayed in tests. The recording script
# refuses to write a key, and this catches one added by hand.
- name: No API keys in test fixtures
run: |
if git grep -n -I -E '(^|[^A-Za-z0-9_])(sk-ant-|sk-proj-|sk-[A-Za-z0-9]{20,})|AIza[0-9A-Za-z_-]{35}' -- 'packages/*/tests/fixtures'; then
echo "::error::A test fixture above looks like it contains an API key. Remove it and rotate the key."
exit 1
fi
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm lint
- name: Build
run: pnpm -r build
- name: Check documentation TypeScript samples
run: pnpm docs:check
# Checks each package's exports, types and files the way npm will see them.
- name: Package checks
run: pnpm publint
# Gzip budgets for the widget bundles are in .size-limit.json.
- name: Widget size budget
run: pnpm size
- name: Typecheck
run: pnpm -r typecheck
# Per-package coverage minimums are in vitest.config.ts.
- name: Test
run: pnpm test:coverage
changeset:
if: github.event_name == 'pull_request' && github.base_ref == 'dev'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# A change under packages/*/src needs a changeset so it shows up in the
# next release. `pnpm changeset --empty` covers changes that shouldn't.
- name: Changeset for package source changes
run: bash .github/scripts/check-changeset.sh origin/${{ github.base_ref }}
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
# e2e/server.mjs runs the real server handler, so build it and core too.
- name: Build the widget and the server
run: pnpm --filter @chatcops/widget --filter "@chatcops/server..." build
- name: Install Chromium
run: pnpm exec playwright install --with-deps chromium
- name: Browser tests
run: pnpm e2e
- name: Upload the report
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: e2e/playwright-report
retention-days: 7