Repository navigation
ci: build and qualify ROCm images through Slurm #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: codeowners | |
| # Keeps CODEOWNERS in sync with the declarative source (.github/codeowners/areas.yaml) | |
| # and gates PRs that would leave a path unowned. Ownership STRUCTURE only -- team | |
| # membership (who is on each team) is managed separately. | |
| on: | |
| pull_request: | |
| paths: | |
| - "**" | |
| push: | |
| branches: [main] | |
| paths: | |
| - "**" | |
| # This workflow runs scripts sourced from the PR diff; keep the token | |
| # read-only and out of the persisted git config (zizmor: artipacked, | |
| # excessive-permissions). | |
| permissions: | |
| contents: read | |
| jobs: | |
| codeowners: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: "3.12" | |
| - run: pip install pyyaml pytest | |
| # Unit tests for the canonical matcher + the emitter's tree-independence | |
| # contract. These are the only piece the gates below trust -- if they | |
| # fail, nothing else means anything. | |
| - name: Unit tests (matcher + tree-independence) | |
| run: | | |
| python -m pytest .github/codeowners/test_codeowners.py -v \ | |
| -p no:cacheprovider \ | |
| --override-ini="addopts=" \ | |
| --override-ini="filterwarnings=" | |
| # Coverage gate on PRs: DIFF-AWARE. checkout builds the base+PR merge | |
| # tree, so git ls-files sees paths that only ever landed on the base | |
| # branch. --changed-only gates just the paths THIS PR adds/renames/ | |
| # modifies vs base.sha; unowned paths inherited unchanged from the base | |
| # are a non-fatal warning. Stale globs split the same way: a glob this | |
| # PR orphans (its last matching file deleted/renamed here) blocks until | |
| # the PR prunes it, while staleness inherited from the base only warns. | |
| # That stops unrelated base churn from red-Xing long-running PRs while | |
| # still requiring the PR's own surface to be 100% owned -- and keeps a | |
| # merged deletion PR from failing the next full-tree run on main. A PR | |
| # that edits ownership policy (areas/scripts/CODEOWNERS) is judged | |
| # full-tree, since a policy edit can orphan any path. base.sha is | |
| # fetched by fetch-depth: 0 above. | |
| - name: Validate coverage and ownership contracts (diff-aware, PR) | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| python .github/codeowners/build_codeowners.py \ | |
| --areas .github/codeowners/areas.yaml \ | |
| --repo . \ | |
| --strict \ | |
| --changed-only \ | |
| --base ${{ github.event.pull_request.base.sha }} | |
| # Coverage gate off PRs (push to main / manual): whole-tree 100%. This is | |
| # the maintenance assertion that every tracked file has a real owner, and | |
| # the only step that reads git ls-files without a diff filter. | |
| - name: Validate coverage and ownership contracts (strict, full tree) | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| python .github/codeowners/build_codeowners.py \ | |
| --areas .github/codeowners/areas.yaml \ | |
| --repo . \ | |
| --strict | |
| # Regenerate, then fail if the committed CODEOWNERS or CONTRIBUTORS.md | |
| # drifted from what the sources produce. emit_codeowners.py is a PURE | |
| # FUNCTION of areas.yaml + external_contributors.yaml (no tree walk), | |
| # so this diff only ever fires when a policy input or a committed output | |
| # actually changed -- never because unrelated files moved on the base | |
| # branch. | |
| - name: Regenerate and check for drift | |
| run: | | |
| python .github/codeowners/emit_codeowners.py \ | |
| --areas .github/codeowners/areas.yaml \ | |
| --out CODEOWNERS \ | |
| --external .github/codeowners/external_contributors.yaml \ | |
| --contributors-out CONTRIBUTORS.md | |
| git diff --exit-code CODEOWNERS CONTRIBUTORS.md \ | |
| || { echo "::error::CODEOWNERS/CONTRIBUTORS.md are out of date. Regenerate from areas.yaml + external_contributors.yaml and commit."; exit 1; } |