-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (95 loc) · 3.83 KB
/
ci.yml
File metadata and controls
119 lines (95 loc) · 3.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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
# Cancel in-progress runs for the same ref
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: "24"
PNPM_VERSION: "10"
jobs:
# ── Typecheck ──────────────────────────────────────────────────────────────
typecheck:
name: TypeScript
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Typecheck (all packages)
run: pnpm run typecheck
# ── OpenAPI spec validation ────────────────────────────────────────────────
openapi:
name: OpenAPI Spec
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Redocly CLI
run: npm install -g @redocly/cli@latest
- name: Validate OpenAPI spec
run: redocly lint lib/api-spec/openapi.yaml --format=stylish
- name: Check spec version matches package.json
run: |
SPEC_VERSION=$(grep "^ version:" lib/api-spec/openapi.yaml | head -1 | awk '{print $2}' | tr -d '"')
PKG_VERSION=$(node -p "require('./package.json').version" 2>/dev/null || echo "0.0.0")
echo "Spec version: $SPEC_VERSION"
echo "Package version: $PKG_VERSION"
# Warn if they diverge (not a hard failure yet — enforced once we reach 1.0)
if [ "$SPEC_VERSION" != "$PKG_VERSION" ]; then
echo "::warning::OpenAPI spec version ($SPEC_VERSION) does not match package.json ($PKG_VERSION)"
fi
# ── Build ──────────────────────────────────────────────────────────────────
build:
name: Build
runs-on: ubuntu-latest
needs: [typecheck]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build shared libs
run: |
pnpm --filter @workspace/db run build 2>/dev/null || true
pnpm --filter @workspace/api-zod run build 2>/dev/null || true
- name: Build API server
run: pnpm --filter @workspace/api-server run build
- name: Build frontend
run: pnpm --filter @workspace/federated-hosting run build
- name: Build CLI
run: pnpm --filter @workspace/cli run build 2>/dev/null || true
# ── Docker build check ─────────────────────────────────────────────────────
docker:
name: Docker
runs-on: ubuntu-latest
# Only run on push to main (not PRs) to save CI minutes
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image (no push)
uses: docker/build-push-action@v6
with:
context: .
push: false
tags: federated-hosting:ci
cache-from: type=gha
cache-to: type=gha,mode=max