mirror of
https://github.com/block/buzz.git
synced 2026-10-27 04:30:52 +00:00
ci: split CI into reusable workflows (#7168)
## Why The monolithic CI workflow is a frequent merge-conflict hotspot. Splitting cohesive domains into same-repository reusable workflows keeps one centrally filtered entry point while letting Rust, desktop, relay/PostgreSQL, client, and security CI evolve independently. ## What - Keep `ci.yml` as the only push/pull-request orchestrator with unchanged concurrency and path detection. - Move 18 execution jobs into five `workflow_call`-only domain workflows without changing their runners, steps, matrices, caches, artifacts, permissions, or timeouts. - Keep the relay artifact producer with desktop integration, the complete PostgreSQL lane, and relay E2E consumers. - Preserve all 12 existing required GitHub Actions contexts through lightweight top-level compatibility gates, so the repository ruleset does not need to change. - Update the Rust-cache contract to follow Unit Tests into `_ci-rust.yml`. ## Risk Assessment CI-only change with moderate workflow-orchestration risk. The main risks are reusable-workflow output propagation, skip behavior, and visible check naming; the old required names remain explicit top-level jobs, and the draft will stay open until an exact-head GitHub Actions run and independent review are complete. Generated with Codex --------- Signed-off-by: Luke Tornquist <tornquist@squareup.com> Signed-off-by: tornquist <tornquist@squareup.com>
This commit is contained in:
148
.github/workflows/_ci-clients.yml
vendored
Normal file
148
.github/workflows/_ci-clients.yml
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
name: CI / Clients
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
web:
|
||||
required: true
|
||||
type: boolean
|
||||
mobile:
|
||||
required: true
|
||||
type: boolean
|
||||
lane:
|
||||
required: true
|
||||
type: string
|
||||
outputs:
|
||||
web_result:
|
||||
value: ${{ jobs.results.outputs.web_result }}
|
||||
mobile_result:
|
||||
value: ${{ jobs.results.outputs.mobile_result }}
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
BUZZ_TEST_POSTGRES_PASSWORD: buzz_dev
|
||||
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.cache/ms-playwright
|
||||
|
||||
jobs:
|
||||
web:
|
||||
name: Web
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
if: inputs.lane == 'required' && (github.event_name == 'push' || inputs.web)
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- uses: cashapp/activate-hermit@cea9af7913204a965fd488637a8d1811bba2e616 # v1
|
||||
- name: Get pnpm store directory
|
||||
id: pnpm-cache
|
||||
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
|
||||
- name: Restore pnpm store cache
|
||||
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||
with:
|
||||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
||||
key: pnpm-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: pnpm-${{ runner.os }}-
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
- name: Web lint and format
|
||||
run: just web-check
|
||||
- name: Web build
|
||||
run: just web-build
|
||||
- name: Save pnpm store cache
|
||||
if: github.event_name == 'push'
|
||||
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||
with:
|
||||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
||||
key: pnpm-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
|
||||
mobile:
|
||||
name: Mobile
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
if: inputs.lane == 'required' && (github.event_name == 'push' || inputs.mobile)
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- uses: cashapp/activate-hermit@cea9af7913204a965fd488637a8d1811bba2e616 # v1
|
||||
- name: Compute Hermit cache key
|
||||
id: hermit-bin-hash
|
||||
run: |
|
||||
hash="$(find ./bin ! -type d | sort | xargs openssl sha256 | openssl sha256 -r | cut -d' ' -f1)"
|
||||
echo "hash=$hash" >> "$GITHUB_OUTPUT"
|
||||
- name: Restore Hermit package cache
|
||||
id: hermit-cache
|
||||
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||
with:
|
||||
path: ~/.cache/hermit/pkg
|
||||
key: ${{ runner.os }}-hermit-cache-${{ steps.hermit-bin-hash.outputs.hash }}
|
||||
restore-keys: ${{ runner.os }}-hermit-cache-
|
||||
- name: Prime Flutter SDK
|
||||
run: flutter --version
|
||||
- name: Save Hermit package cache
|
||||
if: always() && steps.hermit-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: ~/.cache/hermit/pkg
|
||||
key: ${{ runner.os }}-hermit-cache-${{ steps.hermit-bin-hash.outputs.hash }}
|
||||
- name: Restore pub cache
|
||||
id: pub-cache
|
||||
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||
with:
|
||||
path: ~/.pub-cache
|
||||
key: pub-${{ runner.os }}-${{ hashFiles('mobile/pubspec.lock') }}
|
||||
restore-keys: pub-${{ runner.os }}-
|
||||
- name: Install dependencies
|
||||
run: cd mobile && flutter pub get
|
||||
- name: Save pub cache
|
||||
if: always() && steps.pub-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: ~/.pub-cache
|
||||
key: pub-${{ runner.os }}-${{ hashFiles('mobile/pubspec.lock') }}
|
||||
- name: Format check
|
||||
run: cd mobile && dart format --output=none --set-exit-if-changed .
|
||||
- name: Analyze
|
||||
run: cd mobile && flutter analyze
|
||||
- name: Test
|
||||
run: cd mobile && flutter test
|
||||
- name: Build Android debug APK
|
||||
run: just mobile-build-android
|
||||
|
||||
mobile-swift:
|
||||
name: Mobile Swift
|
||||
runs-on: macos-latest
|
||||
timeout-minutes: 30
|
||||
if: inputs.lane == 'mobile-swift' && inputs.mobile
|
||||
steps:
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
- uses: cashapp/activate-hermit@cea9af7913204a965fd488637a8d1811bba2e616 # v1
|
||||
- name: Install Flutter dependencies
|
||||
run: cd mobile && flutter pub get
|
||||
- name: Build
|
||||
run: swift build --package-path mobile/ios/BuzzPushKit
|
||||
- name: Build release
|
||||
run: swift build -c release --package-path mobile/ios/BuzzPushKit
|
||||
- name: Test
|
||||
run: swift test --package-path mobile/ios/BuzzPushKit
|
||||
- name: Build complete unsigned iOS release
|
||||
run: cd mobile && flutter build ios --release --no-codesign --no-pub
|
||||
|
||||
results:
|
||||
name: Results
|
||||
if: ${{ always() }}
|
||||
needs: [web, mobile, mobile-swift]
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions: {}
|
||||
outputs:
|
||||
web_result: ${{ needs.web.result }}
|
||||
mobile_result: ${{ needs.mobile.result }}
|
||||
steps:
|
||||
- run: echo "Captured client job results"
|
||||
Reference in New Issue
Block a user