Repository navigation
44 lines (42 loc) · 2.17 KB
/
Copy pathci.yml
File metadata and controls
44 lines (42 loc) · 2.17 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
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
env:
TYPEDHOOK_TEST_POSTGRES_URL: postgres://postgres:pg@127.0.0.1:5432/webhooks_test
TYPEDHOOK_TEST_MYSQL_URL: mysql://root:mysql@127.0.0.1:3306/webhooks_test
TYPEDHOOK_TEST_MONGO_URL: mongodb://127.0.0.1:27017/?replicaSet=rs0&directConnection=true
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
# Adapter tests run against real databases. Started with docker run
# rather than services: because Mongo needs --replSet for transactions.
- name: Start test databases
run: |
docker run -d --name pg -e POSTGRES_PASSWORD=pg -e POSTGRES_DB=webhooks_test -p 5432:5432 postgres:17
docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=mysql -e MYSQL_DATABASE=webhooks_test -p 3306:3306 mysql:8.4
docker run -d --name mongo -p 27017:27017 mongo:8.2 --replSet rs0 --bind_ip_all
- run: bun install --frozen-lockfile
- run: bun run typecheck
# Both images run a temporary init server first, so wait on TCP, and on
# Mongo electing itself primary after rs.initiate.
- name: Wait for test databases
run: |
until docker exec pg pg_isready -h 127.0.0.1 -U postgres -d webhooks_test; do sleep 1; done
until docker exec mysql mysql -h127.0.0.1 -uroot -pmysql -e "select 1" webhooks_test; do sleep 1; done
until docker exec mongo mongosh --quiet --eval 'rs.initiate({_id:"rs0",members:[{_id:0,host:"127.0.0.1:27017"}]}).ok'; do sleep 1; done
until docker exec mongo mongosh --quiet --eval 'db.hello().isWritablePrimary' | grep -q true; do sleep 1; done
- run: bun test
# GitHub runs the Action straight from the repo, so the committed bundle
# must match its source. typecheck above rebuilt it.
- name: Check publish-action dist is up to date
run: |
if [ -n "$(git status --porcelain packages/publish-action/dist)" ]; then
echo "packages/publish-action/dist is stale: run bun run build and commit it"
git status --porcelain packages/publish-action/dist
exit 1
fi