|
| 1 | +name: GQ Logic Tests |
| 2 | + |
| 3 | +on: |
| 4 | + # Code-bearing events only. The body and label events belong to |
| 5 | + # `fix-regression-gate.yml`, which builds nothing; listing them here |
| 6 | + # would re-run this Rust build on every label change. |
| 7 | + pull_request: |
| 8 | + types: |
| 9 | + - opened |
| 10 | + - synchronize |
| 11 | + - reopened |
| 12 | + push: |
| 13 | + branches: |
| 14 | + - main |
| 15 | + workflow_dispatch: |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: gq-logic-tests-${{ github.ref }} |
| 19 | + # Superseded PR runs are safe to cancel; post-merge main runs stay alive. |
| 20 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 21 | + |
| 22 | +jobs: |
| 23 | + # A job cannot depend on another workflow's job, so this is a verbatim |
| 24 | + # copy of `ci.yml`'s `classify_changes`; `ci.yml` is the source of truth, |
| 25 | + # and an unconditional step at the top of the test job, right after |
| 26 | + # checkout, asserts the two stay identical. |
| 27 | + classify_changes: |
| 28 | + name: Classify Changes (GQ Logic Tests) |
| 29 | + runs-on: ubuntu-latest |
| 30 | + permissions: |
| 31 | + contents: read |
| 32 | + outputs: |
| 33 | + run_full_ci: ${{ steps.filter.outputs.run_full_ci }} |
| 34 | + steps: |
| 35 | + - name: Checkout source |
| 36 | + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 |
| 37 | + with: |
| 38 | + fetch-depth: 0 |
| 39 | + |
| 40 | + - name: Detect documentation-only changes |
| 41 | + id: filter |
| 42 | + env: |
| 43 | + BEFORE_SHA: ${{ github.event.before }} |
| 44 | + EVENT_NAME: ${{ github.event_name }} |
| 45 | + PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} |
| 46 | + PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} |
| 47 | + REF_TYPE: ${{ github.ref_type }} |
| 48 | + run: | |
| 49 | + set -euo pipefail |
| 50 | +
|
| 51 | + if [[ "$EVENT_NAME" == "workflow_dispatch" || "$REF_TYPE" == "tag" ]]; then |
| 52 | + echo "run_full_ci=true" >> "$GITHUB_OUTPUT" |
| 53 | + exit 0 |
| 54 | + fi |
| 55 | +
|
| 56 | + if [[ "$EVENT_NAME" == "pull_request" ]]; then |
| 57 | + base="$PR_BASE_SHA" |
| 58 | + head="$PR_HEAD_SHA" |
| 59 | + else |
| 60 | + base="$BEFORE_SHA" |
| 61 | + head="$GITHUB_SHA" |
| 62 | + if [[ "$base" == "0000000000000000000000000000000000000000" ]]; then |
| 63 | + base="$(git rev-parse "${head}^" 2>/dev/null || true)" |
| 64 | + fi |
| 65 | + fi |
| 66 | +
|
| 67 | + if [[ -z "${base:-}" ]]; then |
| 68 | + echo "run_full_ci=true" >> "$GITHUB_OUTPUT" |
| 69 | + exit 0 |
| 70 | + fi |
| 71 | +
|
| 72 | + # Disable rename collapsing so moving source into docs still reports |
| 73 | + # the source-side deletion and cannot become a docs-only false skip. |
| 74 | + mapfile -t changed < <(git diff --name-only --no-renames "$base" "$head") |
| 75 | + if [[ "${#changed[@]}" -eq 0 ]]; then |
| 76 | + echo "run_full_ci=true" >> "$GITHUB_OUTPUT" |
| 77 | + exit 0 |
| 78 | + fi |
| 79 | +
|
| 80 | + run_full_ci=false |
| 81 | + for path in "${changed[@]}"; do |
| 82 | + case "$path" in |
| 83 | + docs/*.md|docs/*.mdx|docs/*.rst|docs/*.adoc) ;; |
| 84 | + README.md|AGENTS.md|CLAUDE.md|CHANGELOG.md|CONTRIBUTING.md|CODE_OF_CONDUCT.md) ;; |
| 85 | + LICENSE|LICENSE.md) ;; |
| 86 | + *) |
| 87 | + run_full_ci=true |
| 88 | + ;; |
| 89 | + esac |
| 90 | + done |
| 91 | +
|
| 92 | + printf 'Changed files:\n' |
| 93 | + printf ' %s\n' "${changed[@]}" |
| 94 | + echo "run_full_ci=$run_full_ci" >> "$GITHUB_OUTPUT" |
| 95 | +
|
| 96 | + gq_logic_tests: |
| 97 | + name: GQ Logic Tests |
| 98 | + needs: classify_changes |
| 99 | + runs-on: ubuntu-latest |
| 100 | + timeout-minutes: 45 |
| 101 | + permissions: |
| 102 | + contents: read |
| 103 | + env: |
| 104 | + CARGO_TERM_COLOR: always |
| 105 | + # Same floor as the Test Workspace job: unoptimized builds keep every |
| 106 | + # nested async engine frame, deeper than a default 2 MiB thread stack. |
| 107 | + RUST_MIN_STACK: 16777216 |
| 108 | + steps: |
| 109 | + # Unconditional: the copy assertion below must run on every PR, the |
| 110 | + # documentation-only ones included, inside this required context. |
| 111 | + - name: Checkout source |
| 112 | + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 |
| 113 | + |
| 114 | + - name: Assert the classification copy matches ci.yml |
| 115 | + run: python3 scripts/check-classify-copy.py |
| 116 | + |
| 117 | + # Documentation-only change: report success without building, so the |
| 118 | + # required context is never left pending. |
| 119 | + - name: Skip for documentation-only changes |
| 120 | + if: needs.classify_changes.outputs.run_full_ci != 'true' |
| 121 | + run: echo "Documentation-only change detected; skipping the GQ logic tests." |
| 122 | + |
| 123 | + - name: Install system dependencies |
| 124 | + if: needs.classify_changes.outputs.run_full_ci == 'true' |
| 125 | + run: | |
| 126 | + sudo apt-get update |
| 127 | + sudo apt-get install -y protobuf-compiler libprotobuf-dev |
| 128 | +
|
| 129 | + - name: Install Rust stable |
| 130 | + if: needs.classify_changes.outputs.run_full_ci == 'true' |
| 131 | + uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable |
| 132 | + with: |
| 133 | + toolchain: stable |
| 134 | + |
| 135 | + - name: Cache Rust build data |
| 136 | + if: needs.classify_changes.outputs.run_full_ci == 'true' |
| 137 | + uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 |
| 138 | + with: |
| 139 | + workspaces: | |
| 140 | + . -> target |
| 141 | + # PR runs only restore; saving per-PR caches would evict the |
| 142 | + # main-branch entries every warm run depends on. |
| 143 | + save-if: ${{ github.event_name == 'push' }} |
| 144 | + |
| 145 | + - name: Run GQ logic tests |
| 146 | + if: needs.classify_changes.outputs.run_full_ci == 'true' |
| 147 | + run: cargo test -p omnigraph-engine --test gq_logic_tests --locked -- --nocapture |
0 commit comments