|
68 | 68 | id: changes |
69 | 69 | env: |
70 | 70 | GITHUB_EVENT_NAME: ${{ github.event_name }} |
71 | | - GITHUB_BASE_SHA: ${{ github.event.pull_request.base.sha }} |
72 | | - GITHUB_HEAD_SHA: ${{ github.event.pull_request.head.sha }} |
73 | 71 | run: rust-script scripts/detect-code-changes.rs |
74 | 72 |
|
75 | 73 | # === CHANGELOG CHECK - only runs on PRs with code changes === |
@@ -121,11 +119,16 @@ jobs: |
121 | 119 | GITHUB_BASE_REF: ${{ github.base_ref }} |
122 | 120 | run: rust-script scripts/check-version-modification.rs |
123 | 121 |
|
| 122 | + # Lint runs independently of changelog check - it's a fast check that should always run |
| 123 | + # See: https://github.com/link-assistant/hive-mind/pull/1024 for why this dependency was removed |
124 | 124 | # === LINT AND FORMAT CHECK === |
125 | 125 | lint: |
126 | 126 | name: Lint and Format Check |
127 | 127 | runs-on: ubuntu-latest |
128 | 128 | needs: [detect-changes] |
| 129 | + # Note: always() is required because detect-changes is skipped on workflow_dispatch, |
| 130 | + # and without always(), this job would also be skipped even though its condition includes workflow_dispatch. |
| 131 | + # See: https://github.com/actions/runner/issues/491 |
129 | 132 | if: | |
130 | 133 | always() && !cancelled() && ( |
131 | 134 | github.event_name == 'push' || |
@@ -168,11 +171,13 @@ jobs: |
168 | 171 | - name: Check file size limit |
169 | 172 | run: rust-script scripts/check-file-size.rs |
170 | 173 |
|
| 174 | + # Test runs independently of changelog check |
171 | 175 | # === TEST === |
172 | 176 | test: |
173 | 177 | name: Test (${{ matrix.os }}) |
174 | 178 | runs-on: ${{ matrix.os }} |
175 | 179 | needs: [detect-changes, changelog] |
| 180 | + # Run if: push event, OR changelog succeeded, OR changelog was skipped (docs-only PR) |
176 | 181 | if: always() && !cancelled() && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || needs.changelog.result == 'success' || needs.changelog.result == 'skipped') |
177 | 182 | strategy: |
178 | 183 | fail-fast: false |
@@ -203,6 +208,7 @@ jobs: |
203 | 208 | - name: Run doc tests |
204 | 209 | run: cargo test --doc --verbose |
205 | 210 |
|
| 211 | + # Generate and upload code coverage using cargo-llvm-cov |
206 | 212 | # === CODE COVERAGE === |
207 | 213 | coverage: |
208 | 214 | name: Code Coverage |
@@ -248,6 +254,7 @@ jobs: |
248 | 254 | files: lcov.info |
249 | 255 | fail_ci_if_error: false |
250 | 256 |
|
| 257 | + # Build package - only runs if lint and test pass |
251 | 258 | # === BUILD === |
252 | 259 | build: |
253 | 260 | name: Build Package |
@@ -279,10 +286,13 @@ jobs: |
279 | 286 | - name: Check package |
280 | 287 | run: cargo package -p doublets --list --allow-dirty |
281 | 288 |
|
| 289 | + # Automatic release on push to main using changelog fragments |
| 290 | + # This job automatically bumps version based on fragments in changelog.d/ |
282 | 291 | # === AUTO RELEASE === |
283 | 292 | auto-release: |
284 | 293 | name: Auto Release |
285 | 294 | needs: [lint, test, build] |
| 295 | + # Note: always() ensures consistent behavior with other jobs that depend on jobs using always(). |
286 | 296 | if: | |
287 | 297 | always() && !cancelled() && |
288 | 298 | github.event_name == 'push' && |
@@ -346,16 +356,20 @@ jobs: |
346 | 356 | env: |
347 | 357 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
348 | 358 | run: | |
| 359 | + # Use new_version from version-and-commit when available (tag-checked), else fall back to Cargo.toml version |
349 | 360 | RELEASE_VERSION="${{ steps.version.outputs.new_version }}" |
350 | 361 | if [ -z "$RELEASE_VERSION" ]; then |
351 | 362 | RELEASE_VERSION="${{ steps.current_version.outputs.version }}" |
352 | 363 | fi |
353 | 364 | rust-script scripts/create-github-release.rs --release-version "$RELEASE_VERSION" --repository "${{ github.repository }}" |
354 | 365 |
|
| 366 | + # Manual release via workflow_dispatch - only after CI passes |
355 | 367 | # === MANUAL INSTANT RELEASE === |
356 | 368 | manual-release: |
357 | 369 | name: Instant Release |
358 | 370 | needs: [lint, test, build] |
| 371 | + # Note: always() is required to evaluate the condition when dependencies use always(). |
| 372 | + # The build job ensures lint and test passed before this job runs. |
359 | 373 | if: | |
360 | 374 | always() && !cancelled() && |
361 | 375 | github.event_name == 'workflow_dispatch' && |
@@ -457,6 +471,7 @@ jobs: |
457 | 471 | 2. Merge this PR to main |
458 | 472 | 3. The automated release workflow will publish to crates.io and create a GitHub release |
459 | 473 |
|
| 474 | + # Deploy Rust API documentation to GitHub Pages after a successful release |
460 | 475 | # === DEPLOY DOCUMENTATION === |
461 | 476 | deploy-docs: |
462 | 477 | name: Deploy Rust Documentation |
|
0 commit comments