-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (150 loc) · 5.89 KB
/
Copy pathjavascript-build.yml
File metadata and controls
173 lines (150 loc) · 5.89 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: JavaScript Build
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
push:
branches:
- 'main'
paths:
- 'Source/**'
- 'package.json'
- 'rollup.config.mjs'
- 'yarn.lock'
- '.github/workflows/javascript-build.yml'
pull_request:
branches:
- '**'
paths:
- 'Source/**'
- 'package.json'
- 'rollup.config.mjs'
- 'yarn.lock'
- '.github/workflows/javascript-build.yml'
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 23.x
registry-url: 'https://registry.npmjs.org'
- uses: actions/cache@v4
id: yarn-cache
with:
path: |
.yarn/cache
**/node_modules
**/.eslintcache
**/yarn.lock
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
- name: Yarn install
run: yarn
- name: Build JS/TS
run: |
export NODE_OPTIONS="--max-old-space-size=4096"
yarn ci
- name: Build Storybook
run: yarn workspace @cratis/components build-storybook
# Builds the artifact that actually ships to npm (the `prepare` script: tsc -b +
# rollup + copy-css) and loads every subpath of the `exports` map from it.
#
# The `build` job above only runs `tsc -p tsconfig.json`, so nothing in CI had ever
# imported the published shape. That gap is how Cratis/Components#118 - the published
# ESM contains directory imports, so no node-environment spec can render Dialog or
# CommandDialog - reached a release unnoticed.
#
# This job landed deliberately non-blocking, because it reproduced #118 and both of
# that issue's causes were still open: the bare `primereact/*` directory imports
# (fixed by the PrimeReact 11 migration) and the CSS side-effect imports rollup
# externalised via /\.css$/ (fixed by moving component CSS out of the JavaScript
# graph and into the `./styles` entry point). Both are resolved as of 3.0.0 - all 24
# subpaths load cleanly - so `continue-on-error` is gone and this is now a real gate.
verify-published-exports:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 23.x
registry-url: 'https://registry.npmjs.org'
- uses: actions/cache@v4
id: yarn-cache
with:
path: |
.yarn/cache
**/node_modules
**/.eslintcache
**/yarn.lock
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
- name: Yarn install
run: yarn
- name: Build the published artifact
working-directory: Source
run: |
export NODE_OPTIONS="--max-old-space-size=4096"
yarn run prepare
- name: Verify published exports
working-directory: Source
run: node scripts/verify-exports.mjs
verify-arc-consumers:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arc-version: ['20.3.1', '21.19.4', '22.1.0']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 23.x
registry-url: 'https://registry.npmjs.org'
- name: Yarn install
run: yarn
- name: Build and pack Components
run: |
yarn workspace @cratis/components prepare
yarn workspace @cratis/components pack --out /tmp/cratis-components.tgz
- name: Verify Arc ${{ matrix.arc-version }} rendering consumer
run: |
CONSUMER="$(mktemp -d)"
cd "$CONSUMER"
printf '{"private":true,"type":"module"}\n' > package.json
npm install --ignore-scripts \
/tmp/cratis-components.tgz \
"@cratis/arc@${{ matrix.arc-version }}" \
"@cratis/arc.react@${{ matrix.arc-version }}" \
@cratis/fundamentals react@19 react-dom@19
node --input-type=module - <<'NODE'
const commandDialog = await import('@cratis/components/CommandDialog');
const dataPage = await import('@cratis/components/DataPage');
const notifications = await import('@cratis/components/Notifications');
const required = {
CommandDialog: commandDialog.CommandDialog,
DataPage: dataPage.DataPage,
toast: notifications.toast,
};
for (const [name, value] of Object.entries(required)) {
if (!value) throw new Error(`Missing ${name}`);
}
NODE