Skip to content

Commit cf0a857

Browse files
authored
Refine CI gate workflow coverage (#624)
* Refine CI gate workflow coverage * Apply suggestions from code review Co-authored-by: David Pine <david.pine@microsoft.com>
1 parent ef6745c commit cf0a857

File tree

3 files changed

+29
-93
lines changed

3 files changed

+29
-93
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,32 @@ jobs:
3131
exit 0
3232
fi
3333
34-
if git diff --quiet "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" -- src/frontend; then
35-
frontend=false
34+
base_sha="${{ github.event.pull_request.base.sha }}"
35+
head_sha="${{ github.event.pull_request.head.sha }}"
36+
37+
# If the workflow changed, build everything. if it hasn't,
38+
# check for frontend and/or apphost changes...
39+
if git diff --quiet "$base_sha" "$head_sha" -- .github/workflows; then
40+
workflow=false
3641
else
37-
frontend=true
42+
workflow=true
3843
fi
3944
40-
if git diff --quiet "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" -- src/apphost global.json NuGet.config; then
41-
apphost=false
42-
else
45+
if [[ "$workflow" == "true" ]]; then
46+
frontend=true
4347
apphost=true
48+
else
49+
if git diff --quiet "$base_sha" "$head_sha" -- src/frontend; then
50+
frontend=false
51+
else
52+
frontend=true
53+
fi
54+
55+
if git diff --quiet "$base_sha" "$head_sha" -- src/apphost src/statichost global.json NuGet.config; then
56+
apphost=false
57+
else
58+
apphost=true
59+
fi
4460
fi
4561
4662
echo "frontend=$frontend" >> "$GITHUB_OUTPUT"
@@ -58,15 +74,8 @@ jobs:
5874
if: ${{ needs.changes.outputs.apphost == 'true' }}
5975
uses: ./.github/workflows/apphost-build.yml
6076

61-
integration-test:
62-
needs: changes
63-
if: ${{ needs.changes.outputs.frontend == 'true' || needs.changes.outputs.apphost == 'true' }}
64-
uses: ./.github/workflows/integration.yml
65-
with:
66-
node_version: '24.x'
67-
6877
ci-gate:
69-
needs: [changes, frontend-build, apphost-build, integration-test]
78+
needs: [changes, frontend-build, apphost-build]
7079
if: ${{ always() && !cancelled() }}
7180
runs-on: ubuntu-latest
7281
steps:
@@ -78,14 +87,12 @@ jobs:
7887
APPHOST_CHANGED: ${{ needs.changes.outputs.apphost }}
7988
FRONTEND_RESULT: ${{ needs['frontend-build'].result }}
8089
APPHOST_RESULT: ${{ needs['apphost-build'].result }}
81-
INTEGRATION_RESULT: ${{ needs['integration-test'].result }}
8290
run: |
8391
echo "changes result: $CHANGES_RESULT"
8492
echo "frontend changed: $FRONTEND_CHANGED"
8593
echo "frontend-build result: $FRONTEND_RESULT"
8694
echo "apphost changed: $APPHOST_CHANGED"
8795
echo "apphost-build result: $APPHOST_RESULT"
88-
echo "integration-test result: $INTEGRATION_RESULT"
8996
9097
if [[ "$CHANGES_RESULT" != "success" ]]; then
9198
echo "The changes job must succeed."
@@ -111,13 +118,3 @@ jobs:
111118
echo "apphost-build should have been skipped."
112119
exit 1
113120
fi
114-
115-
if [[ "$FRONTEND_CHANGED" == "true" || "$APPHOST_CHANGED" == "true" ]]; then
116-
if [[ "$INTEGRATION_RESULT" != "success" ]]; then
117-
echo "integration-test should have run and succeeded."
118-
exit 1
119-
fi
120-
elif [[ "$INTEGRATION_RESULT" != "skipped" ]]; then
121-
echo "integration-test should have been skipped."
122-
exit 1
123-
fi

.github/workflows/frontend-build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ jobs:
4949
echo "Frontend build failed - dist directory not found"
5050
exit 1
5151
fi
52+
53+
if [ ! -f "dist/index.html" ]; then
54+
echo "Frontend build incomplete - index.html not found"
55+
exit 1
56+
fi
57+
5258
ls -la dist
5359
5460
- name: Upload artifact

.github/workflows/integration.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)