Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
ci: only boot the macOS native lint runner when native sources change (#7283)
Theo Browne8f7da3b99e48
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 4b691459e..3f91ec1b4 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -175,8 +175,90 @@ jobs:- name: Test resource monitorrun: cargo test --locked --manifest-path native/resource-monitor/Cargo.toml+ # The static analysis below needs a macOS runner, which bills ~6.7x a Linux+ # minute, so gate it on the native sources it actually lints instead of paying+ # for it on every push. Detection is API-only (no checkout) and fails open: if+ # the diff cannot be resolved, the lint runs.+ mobile_native_changes:+ name: Mobile Native Changes+ runs-on: blacksmith-2vcpu-ubuntu-2404+ timeout-minutes: 5+ permissions:+ contents: read+ pull-requests: read+ outputs:+ changed: ${{ steps.detect.outputs.changed }}+ steps:+ - name: Detect mobile native changes+ id: detect+ env:+ GH_TOKEN: ${{ github.token }}+ PR_NUMBER: ${{ github.event.pull_request.number }}+ BEFORE_SHA: ${{ github.event.before }}+ run: |+ set -uo pipefail++ fail_open() {+ echo "$* Running native static analysis."+ echo "changed=true" >> "$GITHUB_OUTPUT"+ exit 0+ }++ count_rows() {+ printf '%s\n' "$1" | grep -c . || true+ }++ # One row per changed file, holding the new path and, for a rename,+ # the path it replaced: renaming a matched file out of the matched+ # paths removes a lint input just like editing it.+ row='[.filename, (.previous_filename // empty)] | @tsv'++ if [[ -n "${PR_NUMBER}" ]]; then+ # The PR files endpoint stops at 3000 files and pagination cannot+ # extend it, so cross-check against the count the PR itself reports.+ expected=$(gh api "repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}" --jq '.changed_files') \+ || fail_open "Could not read the pull request."+ rows=$(gh api "repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/files" --paginate --jq ".[] | ${row}") \+ || fail_open "Could not resolve changed files."++ listed=$(count_rows "$rows")+ if [[ "$listed" -lt "$expected" ]]; then+ fail_open "GitHub listed only ${listed} of ${expected} changed files."+ fi+ else+ rows=$(gh api "repos/${GITHUB_REPOSITORY}/compare/${BEFORE_SHA}...${GITHUB_SHA}" --jq ".files[]? | ${row}") \+ || fail_open "Could not resolve changed files."++ # The compare endpoint reports at most 300 files and pagination does+ # not extend that list, so a full list may be hiding native changes.+ listed=$(count_rows "$rows")+ if [[ "$listed" -ge 300 ]]; then+ fail_open "GitHub listed ${listed} changed files, the compare endpoint maximum."+ fi+ fi++ paths=$(tr '\t' '\n' <<< "$rows")++ # Sources scripts/mobile-native-static-check.ts lints, plus the tool+ # and rule configuration that decides how it lints them, plus the+ # root package.json that defines the lint:mobile command.+ pattern='^apps/mobile/.*\.(swift|kt|kts)$|^apps/mobile/(\.swiftlint\.yml|detekt\.yml|\.editorconfig|Brewfile)$|^scripts/mobile-native-static-check\.ts$|^package\.json$|^\.github/workflows/ci\.yml$'++ if grep -qE "$pattern" <<< "$paths"; then+ echo "Native sources or lint configuration changed:"+ grep -E "$pattern" <<< "$paths"+ echo "changed=true" >> "$GITHUB_OUTPUT"+ else+ echo "No mobile native sources or lint configuration changed."+ echo "changed=false" >> "$GITHUB_OUTPUT"+ fi+mobile_native_static_analysis:name: Mobile Native Static Analysis+ needs: mobile_native_changes+ # Skip only on an explicit "no": a gate job that failed or errored leaves the+ # output empty, and that must run the lint rather than silently skip it.+ if: ${{ !cancelled() && needs.mobile_native_changes.outputs.changed != 'false' }}runs-on: blacksmith-6vcpu-macos-26timeout-minutes: 10steps:diff --git a/docs/internals/ci.md b/docs/internals/ci.mdindex e88b9a9e4..bb38fd79a 100644--- a/docs/internals/ci.md+++ b/docs/internals/ci.md@@ -2,8 +2,8 @@> For maintainers. Using T3 Code? See [docs/user](../user/).-[`.github/workflows/ci.yml`](../../.github/workflows/ci.yml) runs four jobs on pull requests and-pushes to `main`:+[`.github/workflows/ci.yml`](../../.github/workflows/ci.yml) runs these quality gates on pull requests+and pushes to `main`:- **Check**: `vp check` (format and lint; this repo sets `typeCheck: false` in its lint options),then `vpr typecheck` for the workspace type check. The same job@@ -11,7 +11,13 @@ pushes to `main`:still exports its expected symbols.- **Test**: `vp run test` across the workspace.- **Mobile Native Static Analysis**: `vp run lint:mobile` on macOS, wrapping- `scripts/mobile-native-static-check.ts`.+ `scripts/mobile-native-static-check.ts`. A cheap Linux **Mobile Native Changes** job gates it:+ the macOS runner only boots when the diff touches `apps/mobile` Swift/Kotlin sources, the+ SwiftLint/detekt/ktlint configuration, the `Brewfile`, the check script, the root `package.json`+ that defines `lint:mobile`, or `ci.yml`. Otherwise the job is skipped, which GitHub reports as+ success for the required check. Renames are matched on both their old and new path. The gate fails+ open in every other case: if the changed-file list cannot be resolved, GitHub truncates it, or the+ gate job itself fails, the lint runs.- **Release Smoke**: exercises release-only workflow steps through `scripts/release-smoke.ts`, sorelease breakage surfaces on PRs rather than at tag time.