-
Notifications
You must be signed in to change notification settings - Fork 63
107 lines (96 loc) · 3.96 KB
/
Copy pathci.yml
File metadata and controls
107 lines (96 loc) · 3.96 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
name: CI
on:
pull_request:
branches: [main, next]
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
# `mise run init` installs deps (frozen lockfile) and builds packages/* —
# so no separate install step is needed. `--no-submodules` skips checkout
# since actions/checkout already fetched them above.
- uses: jdx/mise-action@v4
# Restores the pnpm store (keyed on pnpm-lock.yaml) before the install
# inside `mise run init`. pnpm itself is activated by mise's corepack
# post-install, so this step no-ops on install and is here for the cache.
- uses: pnpm/action-setup@v6
with:
cache: true
- run: mise run init --no-submodules
# Persist Turborepo's local cache (.turbo) across runs so unchanged
# build/test tasks restore instead of recomputing. github.sha makes each
# run save a fresh entry; restore-keys fall back to the most recent cache.
- name: Turborepo cache
uses: actions/cache@v5
with:
path: .turbo
key: turbo-${{ runner.os }}-${{ github.sha }}
restore-keys: |
turbo-${{ runner.os }}-
- name: Format check
run: |
if ! pnpm exec oxfmt --check; then
{
echo "### Unformatted files"
echo '```'
pnpm exec oxfmt --list-different
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
exit 1
fi
# The `zt` template contract generates from the TS types (ADR 0015), so a
# contract change that lands without regenerated artifacts must fail here.
- name: Contract artifacts check
run: |
pnpm --filter @zotlit/db generate:contract
# --porcelain also reports a regenerated file the commit deleted,
# which `git diff` leaves untracked and therefore silent.
stale=$(git status --porcelain -- packages/db/src/contract/generated)
if [ -n "$stale" ]; then
{
echo "### Stale contract artifacts"
echo 'Run `pnpm --filter @zotlit/db generate:contract` and commit the result.'
echo '```'
echo "$stale"
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
exit 1
fi
# The template-data reference page is generated from the contract IR the
# previous step just regenerated, so a contract change without a
# regenerated page must fail here. Call the generator script directly,
# not the turbo task, because a freshness check must always regenerate
# rather than restore a cached output. `mise run init` above builds the
# packages the script imports.
- name: Template data page check
run: |
pnpm --filter @zotlit/docs generate:template-data
stale=$(git status --porcelain -- apps/docs/content/docs/reference/templates/data.mdx)
if [ -n "$stale" ]; then
{
echo "### Stale template data page"
echo 'Run `pnpm --filter @zotlit/docs generate:template-data` and commit the result.'
echo '```'
echo "$stale"
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
exit 1
fi
# oxlint.base.ts sets typeAware + typeCheck, so `-f github` emits ::error
# workflow commands → inline annotations on the diff, type errors included.
# turbo's dependsOn handles transitive builds (no explicit build step).
- name: Lint
run: pnpm lint -- -f github
# Vitest's `github-actions` reporter emits ::error for inline test
# annotations; `default` provides console output. Reporters are passed
# via turbo passthrough.
- name: Test
run: pnpm turbo run test -- --reporter=default --reporter=github-actions