Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
# Pull Request

## Linked Issue

Link each issue this pull request works on, one line each:

- `Closes #N` when it finishes the issue.
- `Part of #N` when it does a slice and the issue stays open.
- `No issue: <reason>` when there is none.

The `pr-links` check fails when an issue named with "fixes", "part of", "slice" or "implements" in the body or a commit message has no such line.

## Changes

List what changed.
Expand Down
25 changes: 21 additions & 4 deletions .github/actions/gate/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
name: gate
description: Run dx check --affected against the pinned base.
description: Run dx check or dx coverage with --affected against the pinned base.
inputs:
command:
description: The dx command, check or coverage.
required: true
lcov:
description: Where dx coverage writes its lcov report.
required: false
default: ""
runs:
using: composite
steps:
Expand All @@ -13,13 +21,21 @@ runs:
# shellcheck disable=SC2086
set -- $BAZEL_CONFIG $BB_ARGS
bazel run "$@" @rules_dx//tools/ci/gate_base:gate_base_bin
- name: Check the affected targets
- name: dx ${{ inputs.command }} --affected
id: check
env:
COMMAND: ${{ inputs.command }}
LCOV: ${{ inputs.lcov }}
shell: bash
run: |
# shellcheck disable=SC2086
set -- $BAZEL_CONFIG $BB_ARGS
bazel run "$@" @rules_dx//:dx -- check --affected --output=json | tee "${RUNNER_TEMP:-/tmp}/gate.json"
set -- --lockfile_mode=error $BAZEL_CONFIG $BB_ARGS
report=()
if [ -n "$LCOV" ]; then
mkdir -p "$(dirname "$LCOV")"
report=(--report "lcov=$LCOV")
fi
bazel run "$@" @rules_dx//:dx -- "$COMMAND" --affected --output=json "${report[@]}" -- "$@" < /dev/null | tee "${RUNNER_TEMP:-/tmp}/gate.json"
- name: Print the failing test log tails
if: ${{ failure() && steps.check.outcome == 'failure' }}
shell: bash
Expand All @@ -28,6 +44,7 @@ runs:
set -- $BAZEL_CONFIG $BB_ARGS
bazel run --noshow_progress "$@" @rules_dx//tools/ci/producers:producers_bin -- --test-log-tails --dx "${RUNNER_TEMP:-/tmp}/gate.json"
- name: Verify the base dx compared against
if: ${{ !cancelled() && steps.check.outcome != 'skipped' }}
shell: bash
run: |
seen="$(jq -Rr 'fromjson? | objects | .affected? | objects | .base? // empty | strings' "${RUNNER_TEMP:-/tmp}/gate.json")"
Expand Down
48 changes: 46 additions & 2 deletions .github/rulesets/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,59 @@
"do_not_enforce_on_create": true,
"required_status_checks": [
{
"context": "gate",
"context": "check (linux_x86_64)",
"integration_id": 15368
},
{
"context": "pr-links",
"context": "check (linux_arm64)",
"integration_id": 15368
},
{
"context": "check (macos_arm64)",
"integration_id": 15368
},
{
"context": "check (windows_x86_64)",
"integration_id": 15368
},
{
"context": "check (windows_arm64)",
"integration_id": 15368
},
{
"context": "coverage (linux_x86_64)",
"integration_id": 15368
},
{
"context": "coverage (linux_arm64)",
"integration_id": 15368
},
{
"context": "coverage (macos_arm64)",
"integration_id": 15368
},
{
"context": "coverage (windows_x86_64)",
"integration_id": 15368
},
{
"context": "coverage (windows_arm64)",
"integration_id": 15368
}
]
}
},
{
"type": "merge_queue",
"parameters": {
"merge_method": "SQUASH",
"grouping_strategy": "ALLGREEN",
"max_entries_to_build": 5,
"min_entries_to_merge": 1,
"max_entries_to_merge": 5,
"min_entries_to_merge_wait_minutes": 1,
"check_response_timeout_minutes": 180
}
}
]
}
16 changes: 9 additions & 7 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
- `release-e2e.yml`: on a `v0.0.0-e2e.*` tag push, calls `reusable-release.yml` from this repository with the `//tools/testing/release_e2e` fixtures: `a_github` alone, or `a_github` then `b_refuses` when the tag contains `partial`. `b_refuses` keeps the placeholder tag `v0.0.0-dryrun`, so its dry run passes and its publish fails.
- `reusable-docs.yml`: `docs-check` plus `docs-publish` (GitHub Pages).
- `docs.yml`: on a push to `main` that changes a page in the user book (`docs/`, `tools/docs/`, the root and example READMEs), or by dispatch, runs `reusable-docs.yml` and publishes the book to https://devhusdk.github.io/rules_dx/. Its `docs` job and the `ci.yml` `docs` job share the `docs-pages-<ref>` concurrency group, so two Pages deploys never overlap.
- `pr-check.yml`: on pull requests and dispatch, an `analysis` job on `ubuntu-latest` for `producers_bin --pr-check` (`tools/ci/producers/src/pr_check.rs`), one step per set (`workflow`, `preflight`, `starter`, `hermetic`, `docs`, `cli`, `kotlin-bench`) so the run shows each set's duration. `preflight` also runs the `ci.yml` crate lockfile check. In parallel, `affected-plan` lists the tests `dx test --affected` reaches and splits them into shards of at most 150, and the `affected` matrix runs one shard per job, so neither the sets nor a change that reaches most of the repository push a job past its time budget. Run one locally from the workspace root with `bazel build //tools/ci/producers:producers_bin && bazel-bin/tools/ci/producers/producers_bin --pr-check <set>`. The owner decides whether it moves to `pull_request` or `merge_group`.
- `api-label.yml`: on pull requests and label changes, fails when the pull request changes a file under `api/` (a rename out of it counts) and has no `api` label. Runs on `ubuntu-slim`.
- `pr-links.yml`: on pull requests, including body edits, runs `producers_bin --pr-links` on the body and commit messages. It also runs on `merge_group`, where it reads the body of the pull request named in the queue ref, and `.github/rulesets/main.json` requires it on main. It fails when the body has no `Closes #N`, `Part of #N` or `No issue: <reason>` line, or when the body or a commit names an issue with a work phrase ("fixes", "part of", "slice", "draft for", "implements", "fixed by this PR") that no `Closes` or `Part of` line links. Replay a body locally with `GITHUB_EVENT_PATH=event.json bazel-bin/tools/ci/producers/producers_bin --pr-links [COMMITS_FILE]`.
- `ci.yml`: this repository's own `ci` gate. A failed Windows preflight build uploads `rmeta-diagnostics-<platform>`.
- When the `gate` check or the `evidence.yml` test task fails, `producers_bin --test-log-tails` prints the last 80 lines of each failing test's `test.log` in its own `::group::` in the job log, for the first 20 failing tests.
- `ci.yml`: on pull requests and in the merge queue, runs `dx check --affected` and `dx coverage --affected --report lcov=$RUNNER_TEMP/coverage/lcov.info` on `linux_x86_64`, `linux_arm64`, `macos_arm64`, `windows_x86_64` and `windows_arm64`, as the jobs `check (<platform>)` and `coverage (<platform>)`. Both use `.github/actions/gate`, which pins the base with `gate_base`: the pull request base, or the queue base in the merge queue. `check (linux_x86_64)` also runs `dx generate` on the whole repo. In the merge queue, each `check` job fails when an `evidence/*` status on the pull request head is not green. Each coverage job uploads its `lcov.info` as `coverage-<platform>` for 7 days. Run the same locally with `tools/dx check --affected` and `tools/dx coverage --affected`. Every other job runs only on schedule or dispatch, and the `ci` job then requires all of them. A failed Windows preflight build uploads `rmeta-diagnostics-<platform>`.
- When the `evidence.yml` test task fails, `producers_bin --test-log-tails` prints the last 80 lines of each failing test's `test.log` in its own `::group::` in the job log, for the first 20 failing tests.
- `ci.yml` jobs `preflight`, `quality-matrix` and `launch-heavy` upload the compact execution log of their test step as `exec-log-<job>-<platform>` for 7 days. To see why spawns missed the cache, download the artifact from two runs and run `bazel run //tools/testing:determinism_check -- diff <first.log> <second.log>`. It prints the 20 slowest remote-cacheable spawns that ran in the second run (`--top N` changes the count), each with the inputs, args and env that differ from the first run, or why it could not hit the cache. Before those lines, up to 5 `origin:` lines follow each differing input back through the spawns that made it, to a changed source file, to a spawn the first run does not have or whose args or env differ, or to a spawn that gave a different output from the same inputs. Last, `not remote cacheable, ran every time:` lists the count and total time of the spawns that cannot be cached, such as test runs, per mnemonic.
- `ci.yml` job `determinism` runs five shards. Each builds a fifth of the top-level packages that hold one target of each `lang.json` entry_points kind, plus `//appimage/...` (shard 0), `//cli/archive/...` (shard 1), `//android/private/packaging/...` (shard 2), `//msix/tests/...` (shard 3) or `//deploy/private/...` (shard 4), twice in fresh output bases with no cache and compares the execution logs against `tools/ci/determinism_allowlist.txt`.
- `ci.yml` job `in-graph-prebuilt-guard` runs `//tools/testing/consumer:in_graph_prebuilt_guard`, which analyzes the `IN_GRAPH_GUARD_LANGS` consumer fixtures of `@dx_api_fixtures` on linux_x86_64, and the `MACOS_IN_GRAPH_GUARD_LANGS` and `WINDOWS_IN_GRAPH_GUARD_LANGS` ones with `--langs` on macos_arm64 and windows_x86_64, with `--//cli/prebuilt:guard_view` and the `dx check` and `dx docs` aspects and fails when they compile a rules_dx binary that `tools/testing/consumer/prebuilt_guard_allowlist.txt` does not name.
Expand All @@ -32,10 +29,15 @@

## Main health

`ci.yml` runs only on `workflow_dispatch`, a daily schedule (`17 3 * * *`, UTC) against the default branch head, and `merge_group`. There are no push or pull-request triggers. Its `gate` job (`statuses: read`) first fails a merge group whose pull request head has a pending, failed or errored `evidence/*` status, then runs `dx check --affected`, checks `MODULE.bazel.lock` is current and checks that its per-platform go_sdk and python entries agree. `.github/rulesets/main.json` requires `gate` and `pr-links` on main. Runs share one concurrency group per ref (`ci-ci-<ref>`, no cancel): a new run on main replaces only the queued one. The repository cache prune runs after scheduled or dispatched main runs. A red scheduled run opens or updates one issue titled `ci: scheduled run is failing` (the `scheduled-report` job). The next green scheduled run closes it. After each scheduled or dispatched run on main, the same job rewrites the pinned issue labelled `known-red` with the test labels that failed in that run. GitHub may delay or drop scheduled runs under load.
`ci.yml` runs every job on `workflow_dispatch` and a daily schedule (`17 3 * * *`, UTC) against the default branch head. Pull requests and the merge queue run only the `check` and `coverage` jobs. There are no push triggers. Runs share one concurrency group per ref (`ci-ci-<ref>`): a new push cancels the pull request run, and a new run on main replaces only the queued one. The repository cache prune runs after scheduled or dispatched main runs. A red scheduled run opens or updates one issue titled `ci: scheduled run is failing` (the `scheduled-report` job). The next green scheduled run closes it. After each scheduled or dispatched run on main, the same job rewrites the pinned issue labelled `known-red` with the test labels that failed in that run. GitHub may delay or drop scheduled runs under load.

The platform table is `PLATFORMS` in `tools/ci/input_validation/src/lib.rs`; `input_validation_test` pins every other copy to it.

Land a PR with `gh pr checks <n> --watch --fail-fast --required`, then `gh pr merge <n> --squash`, never `--admin`.
Land a PR with `gh pr merge <n> --squash --auto`. It joins the merge queue, which squash-merges up to five pull requests at a time once their `check` and `coverage` jobs pass on the queued commit. Never use `--admin`.

`.github/rulesets/main.json` requires these checks on main:

- `check (linux_x86_64)`, `check (linux_arm64)`, `check (macos_arm64)`, `check (windows_x86_64)`, `check (windows_arm64)`
- `coverage (linux_x86_64)`, `coverage (linux_arm64)`, `coverage (macos_arm64)`, `coverage (windows_x86_64)`, `coverage (windows_arm64)`

The consumer contract is [GitHub CI](../../docs/github-ci.md).
40 changes: 0 additions & 40 deletions .github/workflows/api-label.yml

This file was deleted.

Loading
Loading