|
| 1 | +# EPIC: Make CI Change-Aware |
| 2 | + |
| 3 | +## Goal |
| 4 | + |
| 5 | +Reduce unnecessary CI time and runner usage by making heavyweight workflows run only when the |
| 6 | +changed files can affect the behavior they validate. |
| 7 | + |
| 8 | +The current CI setup runs several expensive workflows for almost every pull request, including |
| 9 | +documentation-only changes. That slows down review and merge for low-risk changes and consumes |
| 10 | +GitHub-hosted runner minutes without increasing confidence. |
| 11 | + |
| 12 | +This EPIC groups two implementation subissues plus one related research track: |
| 13 | + |
| 14 | +1. Existing issue [#1726](https://github.com/torrust/torrust-tracker/issues/1726), which researches |
| 15 | + whether `sccache` can reduce Rust build times for the workflows that still need to run. |
| 16 | +2. A new docs-only CI fast path so documentation changes do not wait for full test and E2E |
| 17 | + matrices. |
| 18 | +3. A new persistence-scoped CI strategy so database compatibility and benchmarking workflows only |
| 19 | + run for persistence-relevant changes. |
| 20 | + |
| 21 | +The intent is to reduce waste without weakening the safety net for code changes. |
| 22 | + |
| 23 | +## Why This Is Needed |
| 24 | + |
| 25 | +The following workflows currently run broadly on `push` and `pull_request` events: |
| 26 | + |
| 27 | +- [`.github/workflows/testing.yaml`](../../../.github/workflows/testing.yaml) |
| 28 | +- [`.github/workflows/os-compatibility.yaml`](../../../.github/workflows/os-compatibility.yaml) |
| 29 | +- [`.github/workflows/db-compatibility.yaml`](../../../.github/workflows/db-compatibility.yaml) |
| 30 | +- [`.github/workflows/db-benchmarking.yaml`](../../../.github/workflows/db-benchmarking.yaml) |
| 31 | + |
| 32 | +This has two visible effects: |
| 33 | + |
| 34 | +- Small documentation-only pull requests wait behind workflows that cannot be affected by the |
| 35 | + change. |
| 36 | +- Persistence-specific workflows run even when a pull request does not touch persistence-related |
| 37 | + code. |
| 38 | + |
| 39 | +The repository already has adjacent CI optimization work in progress: |
| 40 | + |
| 41 | +- [#1726](https://github.com/torrust/torrust-tracker/issues/1726) is an evidence-driven research |
| 42 | + issue about Rust compilation costs and whether `sccache` should be adopted at all. |
| 43 | +- [#1740](../1740-fix-container-workflow-caching.md) addresses container build cache behavior. |
| 44 | + |
| 45 | +That makes this a good time to define a coherent, change-aware CI strategy rather than continuing |
| 46 | +with one-off workflow tweaks. |
| 47 | + |
| 48 | +## Scope |
| 49 | + |
| 50 | +This EPIC covers workflow triggering and workflow gating only. |
| 51 | + |
| 52 | +In scope: |
| 53 | + |
| 54 | +- Add a docs-only CI fast path with lightweight checks. |
| 55 | +- Restrict persistence-specific workflows to persistence-relevant changes. |
| 56 | +- Review required-check behavior so selective triggers do not leave pull requests blocked by |
| 57 | + missing or permanently pending checks. |
| 58 | +- Document the path rules and rationale in the workflow files. |
| 59 | + |
| 60 | +Out of scope: |
| 61 | + |
| 62 | +- Rewriting the test matrix. |
| 63 | +- Replacing the current cache strategy wholesale. |
| 64 | +- Container cache optimization already tracked in [#1740](../1740-fix-container-workflow-caching.md). |
| 65 | + |
| 66 | +## Related Research Track |
| 67 | + |
| 68 | +### Research `sccache` impact on remaining heavy workflows |
| 69 | + |
| 70 | +- Existing issue: [#1726](https://github.com/torrust/torrust-tracker/issues/1726) |
| 71 | +- Local spec: [docs/issues/1726-reduce-build-times-sccache/ISSUE.md](./1726-reduce-build-times-sccache/ISSUE.md) |
| 72 | +- Focus: determine, with benchmarks, whether `sccache` reduces compilation cost for workflows that |
| 73 | + still need to run. |
| 74 | +- Relationship to this EPIC: complementary, but not a blocker. The docs-only fast path and |
| 75 | + persistence scoping issues can proceed independently of the `1726` research outcome. |
| 76 | + |
| 77 | +## Implementation Subissues |
| 78 | + |
| 79 | +### Subissue 1: Add a Docs-Only CI Fast Path |
| 80 | + |
| 81 | +- Issue: [#1743](https://github.com/torrust/torrust-tracker/issues/1743) |
| 82 | +- Local spec: [docs/issues/1743-docs-only-ci-fast-path.md](./1743-docs-only-ci-fast-path.md) |
| 83 | +- Focus: skip heavyweight workflows for documentation-only changes while still running markdown |
| 84 | + and spelling checks. |
| 85 | + |
| 86 | +### Subissue 2: Scope Persistence Workflows by Path |
| 87 | + |
| 88 | +- Issue: [#1744](https://github.com/torrust/torrust-tracker/issues/1744) |
| 89 | +- Local spec: |
| 90 | + [docs/issues/1744-scope-persistence-workflows-by-path.md](./1744-scope-persistence-workflows-by-path.md) |
| 91 | +- Focus: run database compatibility and persistence benchmarking only when changes can affect |
| 92 | + persistence behavior. |
| 93 | + |
| 94 | +## Risks and Constraints |
| 95 | + |
| 96 | +### 1. Required checks must remain mergeable |
| 97 | + |
| 98 | +If a workflow is skipped entirely via `paths` or `paths-ignore`, branch protection can treat a |
| 99 | +required check as missing. The implementation must either: |
| 100 | + |
| 101 | +- update required-check configuration to match the new workflow model, or |
| 102 | +- keep the workflow running and use an early change-detection job that exits green when the |
| 103 | + workflow is not relevant. |
| 104 | + |
| 105 | +### 2. `#1726` should not block change-aware trigger work |
| 106 | + |
| 107 | +Issue `#1726` is about reducing the cost of relevant workflows after they start. This EPIC is |
| 108 | +about avoiding irrelevant workflow runs in the first place. |
| 109 | + |
| 110 | +That means: |
| 111 | + |
| 112 | +- docs-only fast-path work should not wait for `sccache` research to finish, |
| 113 | +- persistence workflow scoping should not wait for `sccache` research to finish, and |
| 114 | +- any implementation here should avoid assuming that `sccache` will be adopted. |
| 115 | + |
| 116 | +### 3. "Docs-only" must be defined explicitly |
| 117 | + |
| 118 | +Documentation is not limited to `docs/` in this repository. Relevant documentation paths also |
| 119 | +include files such as: |
| 120 | + |
| 121 | +- `README.md` |
| 122 | +- `SECURITY.md` |
| 123 | +- `AGENTS.md` |
| 124 | +- `.github/skills/**/SKILL.md` |
| 125 | +- package and console `README.md` files |
| 126 | + |
| 127 | +The subissue should define the exact path set and justify it. |
| 128 | + |
| 129 | +### 4. Docs workflow must stay lightweight even if `#1726` is unresolved |
| 130 | + |
| 131 | +The live `#1726` issue confirms that Rust compilation is a major part of CI cost and that the |
| 132 | +benefit of `sccache` is still under research. A docs-only workflow should therefore avoid relying |
| 133 | +on Rust compilation for its main checks when possible. |
| 134 | + |
| 135 | +In practice, that means keeping the docs-only workflow lightweight and avoiding unnecessary |
| 136 | +workspace compilation. Using the internal `linter` binary is acceptable if its installation and |
| 137 | +execution cost stays low enough that the workflow remains fast for documentation-only pull |
| 138 | +requests. |
| 139 | + |
| 140 | +### 5. Persistence workflow scope is intentionally narrower than general regression coverage |
| 141 | + |
| 142 | +The persistence-specific workflows are intended to validate schema, migration, query, and |
| 143 | +persistence-driver behavior in `tracker-core`, not to provide full cross-package regression |
| 144 | +coverage. |
| 145 | + |
| 146 | +For that reason, the corresponding subissue intentionally prefers a narrow trigger centered on |
| 147 | +`packages/tracker-core/**` plus workflow-file changes when relevant. Broader compile and |
| 148 | +integration regressions remain the responsibility of the general testing workflows. |
| 149 | + |
| 150 | +## Acceptance Criteria |
| 151 | + |
| 152 | +- [ ] A documented change-aware CI strategy exists for docs-only and persistence-related changes. |
| 153 | +- [ ] The EPIC links `#1726` as a related research track and links the two new implementation |
| 154 | + subissues. |
| 155 | +- [ ] The final implementation keeps pull requests mergeable under the repository's required-check |
| 156 | + policy. |
| 157 | +- [ ] Heavy workflows no longer run for documentation-only pull requests. |
| 158 | +- [ ] Persistence-specific workflows no longer run for unrelated changes. |
| 159 | + |
| 160 | +## References |
| 161 | + |
| 162 | +- Related issue: [#1726](https://github.com/torrust/torrust-tracker/issues/1726) |
| 163 | +- Related local spec: [docs/issues/1740-fix-container-workflow-caching.md](./1740-fix-container-workflow-caching.md) |
| 164 | +- Related workflows: |
| 165 | + - [`.github/workflows/testing.yaml`](../../../.github/workflows/testing.yaml) |
| 166 | + - [`.github/workflows/os-compatibility.yaml`](../../../.github/workflows/os-compatibility.yaml) |
| 167 | + - [`.github/workflows/db-compatibility.yaml`](../../../.github/workflows/db-compatibility.yaml) |
| 168 | + - [`.github/workflows/db-benchmarking.yaml`](../../../.github/workflows/db-benchmarking.yaml) |
0 commit comments