|
| 1 | +--- |
| 2 | +description: Validates build, tests, licenses, and docs locally, then incrementally commits, pushes, and monitors GitHub CI until a successful build is achieved. |
| 3 | +--- |
| 4 | + |
| 5 | +## Trigger |
| 6 | + |
| 7 | +Use this workflow when: |
| 8 | +- Local changes are ready to be verified, committed, and pushed. |
| 9 | +- The user asks to run the CI validation, commit, push, and monitor workflow. |
| 10 | + |
| 11 | +## Steps |
| 12 | + |
| 13 | +### 1. Run Pre-Commit Local Validation |
| 14 | + |
| 15 | +Ensure all checks pass locally to mimic the GitHub Actions CI environment exactly: |
| 16 | + |
| 17 | +- **Check License Headers**: |
| 18 | + ```powershell |
| 19 | + mvn -B license:check --no-transfer-progress |
| 20 | + ``` |
| 21 | + *If this fails, run `mvn license:format` to apply headers, then stage the changes.* |
| 22 | + |
| 23 | +- **Build with Reproducible Output**: |
| 24 | + ```powershell |
| 25 | + mvn -B clean install --no-transfer-progress -Dproject.build.outputTimestamp=2024-01-01T00:00:00Z |
| 26 | + ``` |
| 27 | + |
| 28 | +- **Verify Reproducible JARs**: |
| 29 | + ```powershell |
| 30 | + mvn -B package -DskipTests --no-transfer-progress -Dproject.build.outputTimestamp=2024-01-01T00:00:00Z -pl '!spector-bench' |
| 31 | + ``` |
| 32 | + |
| 33 | +- **Verify No Dynamic Version Ranges**: |
| 34 | + ```powershell |
| 35 | + mvn -B dependency:tree --no-transfer-progress | Select-String -Pattern '\[(.*,.*)\]|\[.*,\)|\(.*,.*\]|LATEST|RELEASE|SNAPSHOT' | Where-Object { $_.Line -notmatch 'com.spectrayan' -and $_.Line -notmatch 'Building ' -and $_.Line -notmatch 'Reactor Summary' } |
| 36 | + ``` |
| 37 | + *The output must be empty. If dynamic versions are detected, pin them in the respective POM files.* |
| 38 | + |
| 39 | +- **Run Cognitive Benchmark Property Tests**: |
| 40 | + ```powershell |
| 41 | + mvn -B test -pl spector-bench --no-transfer-progress -DskipBenchTests=false -Dtest="*PropertyTest" |
| 42 | + ``` |
| 43 | + |
| 44 | +- **Run Cognitive Benchmark Unit Tests**: |
| 45 | + ```powershell |
| 46 | + mvn -B test -pl spector-bench --no-transfer-progress -DskipBenchTests=false -Dtest="*Test,!*PropertyTest,!*IntegrationTest" |
| 47 | + ``` |
| 48 | + |
| 49 | +- **Build Documentation**: |
| 50 | + ```powershell |
| 51 | + cd docs |
| 52 | + python -m mkdocs build --clean |
| 53 | + cd .. |
| 54 | + ``` |
| 55 | + |
| 56 | +### 2. Verify Local Test Coverage |
| 57 | + |
| 58 | +- **Generate Coverage Report**: |
| 59 | + ```powershell |
| 60 | + mvn -B jacoco:report-aggregate --no-transfer-progress |
| 61 | + ``` |
| 62 | +- **Verify Coverage Baselines**: |
| 63 | + Check coverage metrics using python against `.github/coverage-baseline.json` to ensure there are no unintended regressions. |
| 64 | + |
| 65 | +### 3. Create Incremental Commits |
| 66 | + |
| 67 | +Follow the [Incremental Commits Skill](file:///d:/git/spector-search/.agents/skills/incremental-commits/SKILL.md): |
| 68 | +- Group changes logically by component in strict priority order. |
| 69 | +- Commit each group separately using Conventional Commits format. |
| 70 | + |
| 71 | +### 4. Push to Origin |
| 72 | + |
| 73 | +Push the commits to the remote branch: |
| 74 | +```powershell |
| 75 | +git push origin main |
| 76 | +``` |
| 77 | +*(or the current active branch)* |
| 78 | + |
| 79 | +### 5. Monitor GitHub Actions CI |
| 80 | + |
| 81 | +- Open the browser to: `https://github.com/spectrayan/spector/actions` |
| 82 | +- Locate the workflow run triggered by your latest push/commit. |
| 83 | +- Click into the run and monitor the build steps. |
| 84 | +- Wait until the run finishes (either Success or Failure). |
| 85 | + |
| 86 | +### 6. Handle Build Failures (Loop) |
| 87 | + |
| 88 | +- **If the GitHub Actions run fails**: |
| 89 | + 1. Inspect the detailed logs for the failing step to locate the cause of the failure. |
| 90 | + 2. Implement a fix for the failure locally. |
| 91 | + 3. Re-run the relevant local validation checks from **Step 1**. |
| 92 | + 4. Create a new commit containing the fix. |
| 93 | + 5. Push the changes to GitHub. |
| 94 | + 6. Return to **Step 5** to monitor the new run. |
| 95 | +- **If the GitHub Actions run succeeds**: |
| 96 | + - The workflow is complete. Provide a final summary of the successful run. |
0 commit comments