-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (118 loc) · 4.34 KB
/
Copy pathci.yml
File metadata and controls
139 lines (118 loc) · 4.34 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
validate:
name: typecheck + registry sync
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Typecheck all workspaces
run: npm run typecheck
# Re-runs the sync. If packages/ui/src has drifted from the bundled
# registry, or a manifest is missing a dep, this step exits non-zero.
- name: Validate registry sync
run: npm run registry:sync
# If syncing introduced any file changes, the registry was committed
# stale. Catching that here is much cheaper than discovering it after
# a publish.
- name: Fail if registry is out of date
run: |
if ! git diff --exit-code packages/cli/registry; then
echo ""
echo "::error::packages/cli/registry is stale. Run 'npm run registry:sync' locally and commit the result."
exit 1
fi
- name: Build CLI
run: npm run cli:build
smoke:
name: cli scratch-install + docs-app web build
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Build CLI
run: npm run cli:build
# Catches Expo-side regressions that the typecheck job alone misses
# (Metro/web bundling, react-native-web compat, etc).
- name: Export docs-app web build
working-directory: apps/docs-app
run: npx expo export --platform web
# Pack the built CLI into a tarball so a scratch project can `npm install`
# it exactly the way an end user would consume it from the registry.
# Predict the filename from package.json rather than parsing `npm pack`
# output — npm 10's lifecycle scripts can pollute stdout even with
# --ignore-scripts, which breaks `npm pack --json | jq`.
- name: Pack CLI tarball
id: pack
working-directory: packages/cli
run: |
npm pack --ignore-scripts >/dev/null 2>&1
VERSION=$(node -p "require('./package.json').version")
TARBALL="stylesheet-ui-${VERSION}.tgz"
if [ ! -f "$TARBALL" ]; then
echo "::error::Expected tarball $TARBALL not found in $(pwd)"
ls -la
exit 1
fi
echo "tarball=$(pwd)/$TARBALL" >> "$GITHUB_OUTPUT"
# Minimal scratch project — faster and more reliable than
# `create-expo-app`, and sufficient to typecheck what the CLI emits.
- name: Set up scratch consumer project
run: |
mkdir -p /tmp/smoke/src
cd /tmp/smoke
npm init -y
npm install --save-dev typescript @types/react
npm install --save react react-native
cat > tsconfig.json << 'EOF'
{
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020", "DOM"],
"module": "ESNext",
"moduleResolution": "bundler",
"jsx": "react-native",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"noEmit": true,
"baseUrl": ".",
"paths": { "@/*": ["src/*"] },
"ignoreDeprecations": "6.0"
},
"include": ["src/**/*"]
}
EOF
- name: Install built CLI into scratch project
working-directory: /tmp/smoke
run: npm install --save-dev "${{ steps.pack.outputs.tarball }}"
- name: Run stylesheet-ui init + add
working-directory: /tmp/smoke
run: |
npx stylesheet-ui init --yes
npx stylesheet-ui add button card input switch tabs --yes
# Proves the emitted component sources actually compile against
# vanilla react + react-native types under the default tsconfig the CLI
# implies. A regression here is exactly the kind that would otherwise
# ship to npm undetected.
- name: Typecheck scratch project
working-directory: /tmp/smoke
run: npx tsc --noEmit