Skip to content

Commit b6f2fb2

Browse files
IEvangelistCopilot
andauthored
fix: build frontend before tests to prevent Lunaria CI failures (#712)
Move the Astro production build ahead of test:all so that Lunaria's i18n status page is generated against a pristine git working tree. Previously, the lint step (inside test:all) ran astro sync first, which left generated artifacts on disk. When the build ran afterward, Lunaria detected those changes and failed with a doubled rootDir path (src/frontend/src/frontend/…), producing the error: Failed to retrieve last commit data from …/src/frontend/src/frontend/ src/content/docs/deployment/environments.mdx By building first, Lunaria never sees a polluted working tree. The Playwright install is also deferred until after the build since it is only needed by the test step. Additionally, the build artifact upload now runs before the dist sanity-check so the artifact is always captured for debugging, even when the check fails. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c916912 commit b6f2fb2

File tree

1 file changed

+39
-29
lines changed

1 file changed

+39
-29
lines changed

.github/workflows/frontend-build.yml

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,45 @@ jobs:
6565
- name: Install deps
6666
run: pnpm install --frozen-lockfile
6767

68+
# Build BEFORE tests so that Lunaria (i18n status) runs against a
69+
# pristine working tree. The lint step inside test:all calls
70+
# `astro sync` which can leave generated artifacts on disk; when
71+
# the build ran second, Lunaria would see those as uncommitted
72+
# changes and fail with a doubled rootDir path
73+
# (src/frontend/src/frontend/…).
74+
- name: Build frontend
75+
env:
76+
MODE: production
77+
ASTRO_TELEMETRY_DISABLED: 1
78+
run: pnpm build:production
79+
80+
# Upload before the dist sanity-check so the artifact is always
81+
# available for debugging, even when the check step fails.
82+
# Note: `uses` actions ignore the job-level working-directory,
83+
# so the path is repo-root-relative (src/frontend/dist).
84+
- name: Upload build artifact
85+
if: ${{ always() }}
86+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
87+
with:
88+
name: frontend-dist
89+
path: src/frontend/dist
90+
if-no-files-found: warn
91+
retention-days: 7
92+
93+
- name: Check dist
94+
run: |
95+
if [ ! -d "dist" ]; then
96+
echo "Frontend build failed - dist directory not found"
97+
exit 1
98+
fi
99+
100+
if [ ! -f "dist/index.html" ]; then
101+
echo "Frontend build incomplete - index.html not found"
102+
exit 1
103+
fi
104+
105+
ls -la dist
106+
68107
- name: Install Playwright Chromium
69108
run: pnpm exec playwright install --with-deps chromium
70109

@@ -109,32 +148,3 @@ jobs:
109148
echo '- `frontend-playwright-report`'
110149
echo '- `frontend-test-results`'
111150
} >> "$GITHUB_STEP_SUMMARY"
112-
113-
- name: Build frontend
114-
env:
115-
MODE: production
116-
ASTRO_TELEMETRY_DISABLED: 1
117-
run: pnpm build:production
118-
119-
- name: Check dist
120-
run: |
121-
if [ ! -d "dist" ]; then
122-
echo "Frontend build failed - dist directory not found"
123-
exit 1
124-
fi
125-
126-
if [ ! -f "dist/index.html" ]; then
127-
echo "Frontend build incomplete - index.html not found"
128-
exit 1
129-
fi
130-
131-
ls -la dist
132-
133-
- name: Upload artifact
134-
if: ${{ always() }}
135-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
136-
with:
137-
name: frontend-dist
138-
path: src/frontend/dist
139-
if-no-files-found: warn
140-
retention-days: 7

0 commit comments

Comments
 (0)