-
Notifications
You must be signed in to change notification settings - Fork 4
97 lines (93 loc) 路 3.88 KB
/
Copy pathci.yml
File metadata and controls
97 lines (93 loc) 路 3.88 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
name: CI
on:
pull_request:
# `edited` too: the PR title is linted below, so a retitle has to re-run the check.
types: [opened, synchronize, reopened, edited]
workflow_call:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
commitlint:
# PR only: lints the PR's commits. On pushes to dev/stage the commits already passed
# commitlint on their PR, and the push before-SHA is unreliable (null on a branch's
# first push -> "Invalid revision range 0000...").
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# No turbo here - taking the shared per-commit cache key would lock the verify
# job out of saving its own task outputs.
- uses: ./.github/actions/bootstrap
with:
turbo-cache: 'false'
- name: Commitlint
run: pnpm commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }}
# A squash merge takes the PR title as the commit subject, so an unlinted title
# lands on dev as a commit commitlint would have rejected.
- name: Commitlint PR title
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: echo "$PR_TITLE" | pnpm commitlint
verify:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s
--health-timeout 5s
--health-retries 10
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
DATABASE_ADMIN_URL: postgres://postgres:postgres@localhost:5432/oss_igaming_test
DATABASE_URL: postgres://postgres:postgres@localhost:5432/oss_igaming_test
TEST_ADMIN_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
TEST_REDIS_URL: redis://localhost:6379
TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/oss_igaming_test
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bootstrap
# This cluster holds nothing but throwaway test data, so it buys no safety from
# flushing WAL to disk - and the integration tiers are dominated by commit waits.
# Measured on the same host: 80s -> 29s for the core integration tier. All three
# settings take effect on reload (fsync and full_page_writes are `sighup`,
# synchronous_commit is `user`), so the service container needs no restart.
- name: Trade test-database durability for speed
run: |
psql "$TEST_ADMIN_DATABASE_URL" \
-c "ALTER SYSTEM SET fsync = off" \
-c "ALTER SYSTEM SET full_page_writes = off" \
-c "ALTER SYSTEM SET synchronous_commit = off" \
-c "SELECT pg_reload_conf()"
- name: Prepare migration database
run: pnpm db:setup:test
# Through turbo, not `pnpm --filter`, so the artifact lands in the turbo cache
# and the `build` inside Verify below is a hit instead of a second full tsc.
- name: Build migration runner
run: pnpm exec turbo run build --filter=@openora/core
- name: Run migrations
run: pnpm db:migrate
# Fans out lint, format, boundaries, module shape, deprecations, unit + tool
# tests through turbo (parallel + cached). `build` runs implicitly as the
# test dependency and is what typechecks (every package builds with tsc).
# `pnpm verify` ends with check:drift - no separate step needed.
- name: Verify
run: pnpm verify