Skip to content

Commit 34e5b4c

Browse files
authored
chore: optimize CI to decouple lint from build and skip unnecessary jobs (#214)
* chore: optimize CI to decouple lint from build and skip unnecessary jobs - Added a new input `run_lint_only` to the CI workflow to handle documentation-only changes. - Updated the change detection logic to set `run_lint_only` when no service-impacting changes are detected. - Modified the CI configuration to skip builds and tests when only documentation changes are present, improving efficiency. - Enhanced the output summaries to include documentation change detection results. * chore: refine CI workflow by removing redundant documentation path - Removed the redundant 'docs/**/*.md' inclusion from the CI change detection configuration, streamlining the documentation linting process. * chore: update CI workflow to trigger on main branch pushes - Modified the CI configuration to run on pushes to the main branch, enhancing the workflow's responsiveness to changes in the primary development branch. * chore: consolidate Tauri E2E test workflows into a single reusable configuration - Introduced a new reusable workflow for Tauri E2E tests that encompasses all providers (official, embedded, CrabNebula), streamlining the CI process. - Removed individual workflows for CrabNebula and embedded providers to reduce redundancy and improve maintainability. - Updated the main CI configuration to utilize the new consolidated workflow, enhancing efficiency by reducing the number of runners required for testing. * chore: update CI workflow to improve concurrency handling - Removed tag trigger from the CI configuration to simplify event handling. - Adjusted concurrency cancellation logic to only cancel in-progress jobs for non-pull request events, enhancing workflow efficiency. * chore: update CI workflow descriptions for clarity - Revised the description for the `run_lint_only` input to specify that it applies when no service-affecting changes are detected. - Updated the summary output to reflect the new description, enhancing clarity in the CI process. * refactor: streamline CI workflow result handling - Introduced helper functions to format test results and check outcomes for providers in the CI workflow, improving code readability and maintainability. - Consolidated result logging for official, embedded, and CrabNebula providers to reduce redundancy and enhance clarity in the output summaries. * fix: ensure cleanup commands in CI workflows handle errors gracefully - Updated PowerShell commands in the CI workflow to append '|| true', allowing the cleanup process to continue even if the specified processes are not found, enhancing robustness in both Windows and non-Windows environments. * test(e2e): enhance Tauri E2E logging configuration - Updated the logging exclusion list in the Tauri E2E configuration to include the new logging.tauri-driver.spec.ts file. - Refactored logging directory retrieval in embedded and tauri-driver specs to utilize a new helper function for improved log directory naming based on the driver provider.
1 parent 2a0550f commit 34e5b4c

9 files changed

Lines changed: 294 additions & 1129 deletions

.github/workflows/_ci-detect-changes.reusable.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ on:
2121
has_shared_changes:
2222
description: 'Whether shared packages changed (affects both services)'
2323
value: ${{ jobs.detect.outputs.has_shared_changes }}
24+
run_lint_only:
25+
description: 'Whether to run only lint (no service-affecting changes detected)'
26+
value: ${{ jobs.detect.outputs.run_lint_only }}
2427

2528
jobs:
2629
detect:
@@ -30,6 +33,7 @@ jobs:
3033
run_electron: ${{ steps.determine.outputs.run_electron || 'false' }}
3134
run_tauri: ${{ steps.determine.outputs.run_tauri || 'false' }}
3235
has_shared_changes: ${{ steps.determine.outputs.has_shared_changes || 'false' }}
36+
run_lint_only: ${{ steps.determine.outputs.run_lint_only || 'false' }}
3337

3438
steps:
3539
- name: Checkout Repository
@@ -42,6 +46,10 @@ jobs:
4246
uses: dorny/paths-filter@v4
4347
with:
4448
filters: |
49+
# Documentation only (triggers lint only)
50+
docs:
51+
- '**/*.md'
52+
4553
# Electron service packages
4654
electron_service:
4755
- 'packages/electron-service/**'
@@ -104,6 +112,7 @@ jobs:
104112
fi
105113
106114
echo "::notice::Checking paths-filter outputs..."
115+
echo "docs=${{ steps.changes.outputs.docs }}"
107116
echo "electron_service=${{ steps.changes.outputs.electron_service }}"
108117
echo "tauri_service=${{ steps.changes.outputs.tauri_service }}"
109118
echo "shared=${{ steps.changes.outputs.shared }}"
@@ -113,6 +122,7 @@ jobs:
113122
echo "fixtures_tauri=${{ steps.changes.outputs.fixtures_tauri }}"
114123
echo "infra=${{ steps.changes.outputs.infra }}"
115124
125+
DOCS=${{ steps.changes.outputs.docs }}
116126
ELECTRON=${{ steps.changes.outputs.electron_service }}
117127
TAURI=${{ steps.changes.outputs.tauri_service }}
118128
SHARED=${{ steps.changes.outputs.shared }}
@@ -134,15 +144,24 @@ jobs:
134144
RUN_TAURI="false"
135145
fi
136146
147+
# Lint-only mode when no service-impacting changes detected
148+
# Covers docs-only PRs, config-only edits outside infra, etc.
149+
RUN_LINT_ONLY="false"
150+
if [ "$RUN_ELECTRON" = "false" ] && [ "$RUN_TAURI" = "false" ]; then
151+
RUN_LINT_ONLY="true"
152+
fi
153+
137154
echo "run_electron=$RUN_ELECTRON" >> $GITHUB_OUTPUT
138155
echo "run_tauri=$RUN_TAURI" >> $GITHUB_OUTPUT
139156
echo "has_shared_changes=$SHARED" >> $GITHUB_OUTPUT
157+
echo "run_lint_only=$RUN_LINT_ONLY" >> $GITHUB_OUTPUT
140158
141159
# Create summary for GitHub Step Summary (appears in Actions Summary page)
142160
echo "## Change Detection Summary" >> $GITHUB_STEP_SUMMARY
143161
echo "" >> $GITHUB_STEP_SUMMARY
144162
echo "| Category | Changed |" >> $GITHUB_STEP_SUMMARY
145163
echo "|----------|---------|" >> $GITHUB_STEP_SUMMARY
164+
echo "| Documentation | $DOCS |" >> $GITHUB_STEP_SUMMARY
146165
echo "| Electron service | $ELECTRON |" >> $GITHUB_STEP_SUMMARY
147166
echo "| Tauri service | $TAURI |" >> $GITHUB_STEP_SUMMARY
148167
echo "| Shared packages | $SHARED |" >> $GITHUB_STEP_SUMMARY
@@ -155,14 +174,17 @@ jobs:
155174
echo "### Decisions" >> $GITHUB_STEP_SUMMARY
156175
echo "- **Run Electron**: $RUN_ELECTRON" >> $GITHUB_STEP_SUMMARY
157176
echo "- **Run Tauri**: $RUN_TAURI" >> $GITHUB_STEP_SUMMARY
177+
echo "- **Lint only (no service changes)**: $RUN_LINT_ONLY" >> $GITHUB_STEP_SUMMARY
158178
echo "" >> $GITHUB_STEP_SUMMARY
159179
echo "### Outputs" >> $GITHUB_STEP_SUMMARY
160180
echo "- \`run_electron\`: $RUN_ELECTRON" >> $GITHUB_STEP_SUMMARY
161181
echo "- \`run_tauri\`: $RUN_TAURI" >> $GITHUB_STEP_SUMMARY
162182
echo "- \`has_shared_changes\`: $SHARED" >> $GITHUB_STEP_SUMMARY
183+
echo "- \`run_lint_only\`: $RUN_LINT_ONLY" >> $GITHUB_STEP_SUMMARY
163184
164185
# Also print to logs for debugging
165186
echo "Change Detection Summary:"
187+
echo " Documentation: $DOCS"
166188
echo " Electron service: $ELECTRON"
167189
echo " Tauri service: $TAURI"
168190
echo " Shared packages: $SHARED"
@@ -174,3 +196,4 @@ jobs:
174196
echo ""
175197
echo " Run Electron: $RUN_ELECTRON"
176198
echo " Run Tauri: $RUN_TAURI"
199+
echo " Run lint only: $RUN_LINT_ONLY"

0 commit comments

Comments
 (0)