-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (79 loc) · 2.67 KB
/
Copy pathcli-test.yml
File metadata and controls
95 lines (79 loc) · 2.67 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
name: CLI Unit Test
on:
pull_request:
paths:
- 'apps/cli/**'
- 'apps/frontend/openapi.json'
- '.github/workflows/cli-test.yml'
push:
branches: [main]
paths:
- 'apps/cli/**'
- 'apps/frontend/openapi.json'
- '.github/workflows/cli-test.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '24'
- name: Setup pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
with:
version: 11.20.0
package_json_file: apps/cli/package.json
- name: Get pnpm store path
id: pnpm-cache
run: echo "store=$(pnpm store path)" >> $GITHUB_OUTPUT
working-directory: apps/cli
- name: Cache pnpm store
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ steps.pnpm-cache.outputs.store }}
key: pnpm-store-${{ runner.os }}-${{ hashFiles('apps/cli/pnpm-lock.yaml') }}
restore-keys: |
pnpm-store-${{ runner.os }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile
working-directory: apps/cli
- name: Generate CLI OpenAPI types
run: pnpm openapi:generate
working-directory: apps/cli
- name: Type-check CLI application
run: pnpm build
working-directory: apps/cli
- name: Type-check contract tests
run: pnpm typecheck:test
working-directory: apps/cli
- name: Check generated CLI OpenAPI type drift
run: |
set -euo pipefail
if git diff --quiet -- src/api/openapi.d.ts; then
echo "CLI OpenAPI types are in sync."
exit 0
fi
echo "::error::apps/cli/src/api/openapi.d.ts is out of sync with apps/frontend/openapi.json."
echo ""
echo "After changing the API surface, regenerate and commit the CLI types:"
echo " cd apps/cli && pnpm openapi:generate"
echo " git add apps/cli/src/api/openapi.d.ts"
echo ""
echo "Diff:"
git diff -- src/api/openapi.d.ts | head -200 || true
exit 1
working-directory: apps/cli
- name: Run tests
run: pnpm test
working-directory: apps/cli