Skip to content

Commit fb2eabd

Browse files
committed
feat: enhance CI workflow with path filtering and separate build jobs for core and docs
1 parent f9318ee commit fb2eabd

2 files changed

Lines changed: 96 additions & 7 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@objectstack/core": patch
3+
"@objectstack/runtime": patch
4+
---
5+
6+
fix: resolve "process is not defined" runtime error in browser environments by adding safe environment detection and polyfills

.github/workflows/ci.yml

Lines changed: 90 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,40 @@ on:
99
- main
1010

1111
jobs:
12+
filter:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
pull-requests: read
17+
outputs:
18+
docs: ${{ steps.changes.outputs.docs }}
19+
core: ${{ steps.changes.outputs.core }}
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- uses: dorny/paths-filter@v3
25+
id: changes
26+
with:
27+
filters: |
28+
docs:
29+
- 'apps/docs/**'
30+
- 'content/**'
31+
- 'pnpm-lock.yaml'
32+
- '.github/workflows/ci.yml'
33+
core:
34+
- 'packages/**'
35+
- 'examples/**'
36+
- 'apps/!(docs)/**'
37+
- 'package.json'
38+
- 'pnpm-lock.yaml'
39+
- 'tsconfig.json'
40+
- '.github/workflows/ci.yml'
41+
1242
test:
13-
name: Test
43+
name: Test Core
44+
needs: filter
45+
if: needs.filter.outputs.core == 'true'
1446
runs-on: ubuntu-latest
1547
permissions:
1648
contents: read
@@ -52,14 +84,16 @@ jobs:
5284
run: pnpm --filter @objectstack/spec test:coverage
5385

5486
- name: Upload coverage reports
55-
uses: actions/upload-artifact@v6
87+
uses: actions/upload-artifact@v4
5688
with:
5789
name: coverage-report
5890
path: packages/spec/coverage/
5991
retention-days: 30
6092

61-
build:
62-
name: Build
93+
build-core:
94+
name: Build Core
95+
needs: filter
96+
if: needs.filter.outputs.core == 'true'
6397
runs-on: ubuntu-latest
6498
permissions:
6599
contents: read
@@ -94,8 +128,8 @@ jobs:
94128
- name: Install dependencies
95129
run: pnpm install --frozen-lockfile
96130

97-
- name: Build packages
98-
run: pnpm run build
131+
- name: Build packages (excluding docs)
132+
run: pnpm --filter !@objectstack/docs -r build
99133

100134
- name: Verify build outputs
101135
run: |
@@ -110,10 +144,59 @@ jobs:
110144
echo "Build outputs verified successfully"
111145
112146
- name: Upload build artifacts
113-
uses: actions/upload-artifact@v6
147+
uses: actions/upload-artifact@v4
114148
with:
115149
name: build-output
116150
path: |
117151
packages/spec/dist/
118152
packages/spec/json-schema/
119153
retention-days: 30
154+
155+
build-docs:
156+
name: Build Docs
157+
needs: filter
158+
if: needs.filter.outputs.docs == 'true'
159+
runs-on: ubuntu-latest
160+
permissions:
161+
contents: read
162+
163+
steps:
164+
- name: Checkout repository
165+
uses: actions/checkout@v4
166+
167+
- name: Setup Node.js
168+
uses: actions/setup-node@v4
169+
with:
170+
node-version: '20'
171+
172+
- name: Install pnpm
173+
uses: pnpm/action-setup@v4
174+
with:
175+
version: 10.28.1
176+
177+
- name: Get pnpm store directory
178+
shell: bash
179+
run: |
180+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
181+
182+
- name: Setup pnpm cache
183+
uses: actions/cache@v4
184+
with:
185+
path: ${{ env.STORE_PATH }}
186+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
187+
restore-keys: |
188+
${{ runner.os }}-pnpm-store-
189+
190+
- name: Setup Next.js cache
191+
uses: actions/cache@v4
192+
with:
193+
path: apps/docs/.next/cache
194+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('apps/docs/**.[jt]s', 'apps/docs/**.[jt]sx', 'content/**/*.mdx') }}
195+
restore-keys: |
196+
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
197+
198+
- name: Install dependencies
199+
run: pnpm install --frozen-lockfile
200+
201+
- name: Build Docs
202+
run: pnpm --filter @objectstack/docs build

0 commit comments

Comments
 (0)