Skip to content

Commit 7df6396

Browse files
committed
ci: rework turbo task graph for affected builds and CLI-dependent indexing
1 parent 401bbb8 commit 7df6396

5 files changed

Lines changed: 52 additions & 12 deletions

File tree

.github/actions/build-packages/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ runs:
1717
- name: Build project [affected]
1818
if: ${{ inputs.only-affected == 'true' }}
1919
shell: bash
20-
run: pnpm turbo run build --continue --filter=...[origin/${{ github.base_ref }}]
20+
run: pnpm turbo run build --continue --affected

.github/workflows/index-docs.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,8 @@ jobs:
5252
with:
5353
node-version: 24
5454

55-
- name: Install dependencies and build CLI
56-
run: |
57-
pnpm install
58-
pnpm build:cli
55+
- name: Install dependencies
56+
run: pnpm install
5957

6058
- name: Resolve index config
6159
id: index
@@ -111,7 +109,7 @@ jobs:
111109
- name: Ensure index exists
112110
env:
113111
FUSION_ENV: ${{ vars.FUSION_ENV }}
114-
run: pnpm exec ffc ai index create --env "$FUSION_ENV" --config ./fusion-ai.config.ts
112+
run: pnpm exec turbo run index:docs:create
115113

116114
- name: Index docs to Azure AI Search
117115
timeout-minutes: 30
@@ -122,15 +120,16 @@ jobs:
122120
run: |
123121
set -euo pipefail
124122
123+
# turbo builds the CLI on demand via the index:docs:<mode> task's dependsOn
125124
if [[ "$MODE" == "clean" ]]; then
126125
echo "::notice::Running clean rebuild — all existing embeddings will be deleted first"
127-
pnpm exec ffc ai index add --clean --env "$FUSION_ENV" --config ./fusion-ai.config.ts
126+
pnpm exec turbo run index:docs:clean
128127
elif [[ "$MODE" == "diff" ]]; then
129128
echo "::notice::Running incremental indexing from base ref ${BASE_REF}"
130-
pnpm exec ffc ai index add --diff --base-ref "$BASE_REF" --env "$FUSION_ENV" --config ./fusion-ai.config.ts
129+
pnpm exec turbo run index:docs:diff
131130
else
132131
echo "::notice::Running full indexing (no safe base ref available)"
133-
pnpm exec ffc ai index add --env "$FUSION_ENV" --config ./fusion-ai.config.ts
132+
pnpm exec turbo run index:docs:full
134133
fi
135134
136135
- name: Configure git user

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
continue-on-error: true
108108
uses: ./.github/actions/build-packages
109109
with:
110-
only-affected: false
110+
only-affected: true
111111

112112
- name: process-build-log
113113
run: node process-turbo-build-log.cjs > tsc-build.log

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,18 @@
2525
"build:packages": "turbo build --filter './packages/**' build",
2626
"build:cookbooks": "turbo build --filter './cookbooks/**' build",
2727
"build:docs": "turbo build --filter '@equinor/fusion-framework-docs' build",
28-
"build:affected": "turbo build --filter=...[origin/main] build",
28+
"build:affected": "turbo run build --affected",
2929
"build:clean": "pnpm clean:build && pnpm build --force",
3030
"eval:app": "pnpm exec ffc copilot app eval",
3131
"eval:app:fast": "pnpm exec ffc copilot app eval --model claude-haiku-4.5",
3232
"index:packages": "pnpm exec ffc ai index add packages",
3333
"index:cookbooks": "pnpm exec ffc ai index add cookbooks",
3434
"preindex:eds": "rm -rf eds/out && docker buildx build --target export --output type=local,dest=./eds/out eds",
3535
"index:eds": "pnpm exec ffc ai index add --clean --config eds/fusion-ai.config.ts eds/out",
36+
"index:docs:create": "pnpm exec ffc ai index create --env \"$FUSION_ENV\" --config ./fusion-ai.config.ts",
37+
"index:docs:clean": "pnpm exec ffc ai index add --clean --env \"$FUSION_ENV\" --config ./fusion-ai.config.ts",
38+
"index:docs:full": "pnpm exec ffc ai index add --env \"$FUSION_ENV\" --config ./fusion-ai.config.ts",
39+
"index:docs:diff": "pnpm exec ffc ai index add --diff --base-ref \"$BASE_REF\" --env \"$FUSION_ENV\" --config ./fusion-ai.config.ts",
3640
"check": "biome check",
3741
"check:errors": "biome check --diagnostic-level=error",
3842
"lint": "pnpm lint:biome && pnpm lint:fusion",

turbo.json

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,48 @@
11
{
2-
"$schema": "https://turbo.build/schema.json",
2+
"$schema": "https://turborepo.dev/schema.json",
33
"globalPassThroughEnv": ["GITHUB_ACTIONS"],
44
"tasks": {
55
"build": {
66
"dependsOn": ["^build"],
77
"outputs": ["dist/**"],
88
"cache": true
9+
},
10+
"//#preindex:eds": {
11+
"inputs": ["eds/Dockerfile", "eds/*.ts"],
12+
"outputs": ["eds/out/**"],
13+
"cache": true
14+
},
15+
"//#index:eds": {
16+
"dependsOn": ["@equinor/fusion-framework-cli#build", "//#preindex:eds"],
17+
"cache": false
18+
},
19+
"//#index:packages": {
20+
"dependsOn": ["@equinor/fusion-framework-cli#build"],
21+
"cache": false
22+
},
23+
"//#index:cookbooks": {
24+
"dependsOn": ["@equinor/fusion-framework-cli#build"],
25+
"cache": false
26+
},
27+
"//#index:docs:create": {
28+
"dependsOn": ["@equinor/fusion-framework-cli#build"],
29+
"cache": false,
30+
"passThroughEnv": ["FUSION_ENV"]
31+
},
32+
"//#index:docs:clean": {
33+
"dependsOn": ["@equinor/fusion-framework-cli#build"],
34+
"cache": false,
35+
"passThroughEnv": ["FUSION_ENV"]
36+
},
37+
"//#index:docs:full": {
38+
"dependsOn": ["@equinor/fusion-framework-cli#build"],
39+
"cache": false,
40+
"passThroughEnv": ["FUSION_ENV"]
41+
},
42+
"//#index:docs:diff": {
43+
"dependsOn": ["@equinor/fusion-framework-cli#build"],
44+
"cache": false,
45+
"passThroughEnv": ["FUSION_ENV", "BASE_REF"]
946
}
1047
}
1148
}

0 commit comments

Comments
 (0)