Repository navigation
fix(ci): add docs-only paths-ignore to container and coverage workflows - #1762
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1762 +/- ##
========================================
Coverage 79.44% 79.44%
========================================
Files 369 369
Lines 27328 27328
Branches 27328 27328
========================================
Hits 21710 21710
Misses 5337 5337
Partials 281 281 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The issue torrust#1743 implementation added paths-ignore rules to testing.yaml and os-compatibility.yaml but missed container.yaml and generate_coverage_pr.yaml. Docs-only pull requests (e.g. PR torrust#1760) were still triggering the container build and coverage jobs unnecessarily. Add the same paths-ignore exclusions to both workflows and update the docs-lint.yaml path-policy comment to accurately reflect which workflows carry the rule.
8b748b2 to
2b177a2
Compare
|
ACK 2b177a2 |
da2ce7
left a comment
There was a problem hiding this comment.
This is a post-merge review of #1762 as the change stands at e170b9620 on the default branch.
The diff does what its description says, apart from the phrase taken up in the Nit below, and all of it still runs unchanged: paths-ignore lists for **/*.md and project-words.txt on the push and pull_request triggers of .github/workflows/container.yaml (lines 17-19 and 24-26) and on the pull_request trigger of .github/workflows/generate_coverage_pr.yaml (lines 11-13; the workflow's display name became Generate Coverage Reports (PR) in 198c0ba), and the policy comment at .github/workflows/docs-lint.yaml:8-17. A change in which every file is Markdown or the dictionary starts neither workflow, whether it is a pull request or a push to develop, main or releases/**.
[Minor] Documentation-only pushes publish no container image, and on a release branch the publish now depends on which files GitHub counts as changed by the push that creates the branch. The push filter at .github/workflows/container.yaml:17-19 also covers releases/**/*, and such a push is the only way to reach publish_release (.github/workflows/container.yaml:259): the workflow has no manual or tag trigger. Section 5 of docs/release-process/tracker.md cuts the branch with git push torrust main:releases/v[semantic version] (line 62), a push that carries no new commit, and ruleset 94096 (docs/github-rulesets.md:47) refuses any later update of the branch. GitHub starts no workflow when every file it counts as changed matches paths-ignore, or when it counts none, and for a push that creates a branch it counts them from the commits pushed, so for a push without new commits the outcome is not fixed by anything in the repository. Where GitHub counts no file there, or only Markdown, the release publishes its crate through .github/workflows/deployment.yaml:13-16, which has no path filter, but no X.Y.Z, X.Y, X or latest image, and re-creating the branch at the same commit counts the same files. Before c523b1d that push always started the workflow; the newest version tag in the repository, v3.0.0 (2024), predates the filter, so the release path has not run under it yet. On develop and main the skip only leaves the branch tag on the previous image, which holds the same binary, unless the last code push's run failed, in which case the tag stays behind until the next code push. The description motivates the change with documentation-only pull requests; the smallest fix is to delete lines 17-19 and keep the pull_request filter at lines 24-26.
[Minor] The documentation-only set includes Markdown that the workspace compiles into tests, so a pull request that changes only such a file skips every workflow that runs those tests. contrib/dev-tools/github/github-review-threads/src/lib.rs:411 reads the fetch-review-threads skill document with include_str!, and the test at line 475 fails when the fallback query documented there drifts from the query the tool sends; contrib/dev-tools/checks/frontmatter-validator/tests/cli.rs:16-20 and contrib/dev-tools/checks/frontmatter-validator/src/profile.rs:728 read the Markdown fixtures under contrib/dev-tools/checks/frontmatter-validator/fixtures/. A pull request that edits only that skill's fallback query, or makes an accepted fixture invalid, matches **/*.md: Testing (#1746) and the coverage workflow (.github/workflows/generate_coverage_pr.yaml:11-13, whose cargo llvm-cov --all-features --workspace job runs both crates' tests) are skipped, and Docs Lint runs the validator's --skill-layout and --skill-descriptions checks but neither crate's tests. The breakage then surfaces on the next unrelated code pull request. The policy comment at .github/workflows/docs-lint.yaml:12 lists SKILL.md as documentation. The smallest fix is a cargo test -p github-review-threads -p frontmatter-validator entry in Docs Lint, which already compiles frontmatter-validator; taking those paths out of the documentation-only set instead means changing all four paths-ignore lists and DOCUMENTATION_ONLY at contrib/dev-tools/checks/ci-gate/src/change_detection.rs:73 together.
[Nit] .github/workflows/docs-lint.yaml:10-11 says db-compatibility.yaml and db-benchmarking.yaml "are already scoped to code paths via paths: inclusion rules", but those rules (.github/workflows/db-compatibility.yaml:16,21 and .github/workflows/db-benchmarking.yaml:14-15,20-21) name whole package directories that hold Markdown: six files under packages/tracker-core/, among them README.md and the reports under docs/benchmarking/, and packages/persistence-benchmark/README.md. A pull request that changes only packages/tracker-core/README.md starts both workflows, six database-compatibility jobs and three benchmark jobs, although the header at lines 4-6 says documentation-only pull requests are excluded from the compatibility workflows. The smallest fix is to reword the comment to say a Markdown change under those directories still runs them; excluding it instead means appending "!**/*.md" to the four paths: lists and mirroring that in the two path-only rules of contrib/dev-tools/checks/ci-gate/src/change_detection.rs.
Checked and found sound: both new lists are identical to the ones #1746 added to testing.yaml and os-compatibility.yaml, so the docker-e2e job of testing.yaml, which stands down whenever the Container workflow would run, never leaves a code change without the end-to-end suite; **/*.md matches Markdown at the repository root as well as below it, and project-words.txt only the root dictionary; the comment's list of the four workflows that carry paths-ignore is accurate at this commit; the rules in contrib/dev-tools/checks/ci-gate/src/change_detection.rs reproduce both new filters with their branch lists; no status check is required (docs/github-rulesets.md), so a skipped workflow cannot hold a pull request open; and the filters only remove runs, adding no secret, permission, runner or trigger.
Bug
Issue #1743 added
paths-ignorerules to the CI "docs-only fast path" fortesting.yamlandos-compatibility.yaml, but two workflows were missed:container.yaml— the container build jobgenerate_coverage_pr.yaml— the coverage report jobAs a result, docs-only pull requests (e.g. PR #1760) were still triggering the
container build and coverage jobs unnecessarily, wasting CI minutes and
delaying feedback.
Fix
Add the same
paths-ignoreexclusions to both workflows:Also update the path-policy comment in
docs-lint.yamlto accurately list allworkflows that carry the
paths-ignorerule (replacing the stale list thatmentioned
db-compatibility.yamlanddb-benchmarking.yaml, which are alreadyscoped to code paths via
paths:inclusion rules).Changed files
.github/workflows/container.yaml— Addedpaths-ignoreto bothpushandpull_requesttriggers, plus path-policy comment..github/workflows/generate_coverage_pr.yaml— Addedpaths-ignoreto thepull_requesttrigger, plus path-policy comment..github/workflows/docs-lint.yaml— Updated header comment to correctly list workflows that carrypaths-ignorerules.References