Skip to content

Commit 205a6c7

Browse files
jonphippsclaude
andcommitted
feat: optimize CI/CD with Nx Cloud distributed execution and artifact sharing
- Enable Nx Cloud distributed task execution with 6 agents for parallel builds - Increase parallel execution from 3 to 6 to match site count - Add .docusaurus to build cache outputs for better caching - Replace matrix build strategy with nx affected commands for efficiency - Fix artifact sharing between CI jobs to resolve sitemap validation failures - Generate Nx dependency graph and performance report for monitoring 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent c7b52aa commit 205a6c7

File tree

10 files changed

+113
-13
lines changed

10 files changed

+113
-13
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
permissions:
10+
actions: read
11+
contents: read
12+
13+
jobs:
14+
main:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
filter: tree:0
20+
fetch-depth: 0
21+
22+
- uses: pnpm/action-setup@v4
23+
name: Install pnpm
24+
with:
25+
run_install: false
26+
27+
# This enables task distribution via Nx Cloud
28+
# Run this command as early as possible, before dependencies are installed
29+
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
30+
- run: pnpm dlx nx-cloud start-ci-run --distribute-on="6 linux-medium-js" --stop-agents-after="build"
31+
32+
# Cache node_modules
33+
- uses: actions/setup-node@v4
34+
with:
35+
node-version: 20
36+
cache: 'pnpm'
37+
38+
- run: pnpm install --frozen-lockfile
39+
- uses: nrwl/nx-set-shas@v4
40+
41+
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
42+
# - run: pnpm exec nx-cloud record -- echo Hello World
43+
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
44+
- run: pnpm exec nx affected -t lint test build --parallel=6

.github/workflows/test-site-builds.yml

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,43 @@ jobs:
201201
uses: actions/download-artifact@v4
202202
with:
203203
pattern: build-*
204-
path: .
204+
path: artifacts
205205

206-
- name: Debug - Check artifact structure
206+
- name: Restore build artifacts to proper locations
207207
run: |
208-
echo "=== Current directory structure ==="
208+
echo "=== Restoring artifacts to proper directory structure ==="
209+
# Create directories if they don't exist
210+
mkdir -p portal standards
211+
212+
# Move portal build if it exists
213+
if [ -d "artifacts/build-portal/portal" ]; then
214+
echo "Moving portal build..."
215+
cp -r artifacts/build-portal/portal/* portal/
216+
fi
217+
218+
# Move standards builds if they exist
219+
for site in ISBDM LRM FRBR isbd muldicat unimarc; do
220+
if [ -d "artifacts/build-$site/standards/$site" ]; then
221+
echo "Moving $site build..."
222+
mkdir -p "standards/$site"
223+
cp -r "artifacts/build-$site/standards/$site"/* "standards/$site/"
224+
fi
225+
done
226+
227+
- name: Debug - Check restored structure
228+
run: |
229+
echo "=== Current directory structure after restore ==="
209230
ls -la
210-
echo "=== Looking for portal directory ==="
231+
echo "=== Portal structure ==="
211232
ls -la portal/ 2>/dev/null || echo "No portal directory found"
212-
echo "=== Looking for standards directory ==="
233+
echo "=== Standards structure ==="
213234
ls -la standards/ 2>/dev/null || echo "No standards directory found"
214-
echo "=== Looking for build-* directories ==="
215-
ls -la build-*/ 2>/dev/null || echo "No build-* directories found"
235+
if [ -d "standards" ]; then
236+
for site in standards/*/; do
237+
echo "=== $site structure ==="
238+
ls -la "$site" 2>/dev/null || echo "No $site directory found"
239+
done
240+
fi
216241
echo "=== Searching for sitemap.xml files ==="
217242
find . -name "sitemap.xml" -type f | head -10
218243

nx.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"!{projectRoot}/.docusaurus/**/*",
77
"!{projectRoot}/build/**/*",
88
"!{projectRoot}/dist/**/*",
9-
"!{projectRoot}/node_modules/**/*"
9+
"!{projectRoot}/node_modules/**/*",
10+
"sharedGlobals"
1011
],
1112
"production": [
1213
"default",
@@ -39,12 +40,13 @@
3940
"{projectRoot}/static/**/*",
4041
"{workspaceRoot}/packages/preset-ifla/**/*",
4142
"{workspaceRoot}/libs/shared-config/**/*"
42-
]
43+
],
44+
"sharedGlobals": ["{workspaceRoot}/.github/workflows/ci.yml"]
4345
},
4446
"targetDefaults": {
4547
"build": {
4648
"dependsOn": ["^build"],
47-
"outputs": ["{projectRoot}/build", "{projectRoot}/dist"],
49+
"outputs": ["{projectRoot}/build", "{projectRoot}/dist", "{projectRoot}/.docusaurus"],
4850
"cache": true,
4951
"inputs": ["production", "^production", "docusaurus"]
5052
},
@@ -126,6 +128,6 @@
126128
"cli": {
127129
"analytics": false
128130
},
129-
"parallel": 3,
131+
"parallel": 6,
130132
"cacheDirectory": ".nx/cache"
131133
}

static/environment.js

Lines changed: 23 additions & 0 deletions
Large diffs are not rendered by default.

static/favicon.ico

14.7 KB
Binary file not shown.

static/main.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/runtime.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)