Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116name: cli-git performance
on: pull_request: branches: ['main'] paths: - 'package/git-policy/cli/package.json' push: branches: ['main'] paths: - 'package/git-policy/cli/package.json' workflow_dispatch:
concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true
permissions: contents: read
jobs: detect-version-bump: runs-on: ubuntu-latest outputs: should_run: ${{ steps.detect.outputs.should_run }} steps: - name: Checkout version history uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with: fetch-depth: 0
- name: Detect cli-git version bump id: detect env: BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} EVENT_NAME: ${{ github.event_name }} shell: node {0} run: | const { execFileSync, } = require('node:child_process') const { appendFileSync, readFileSync, } = require('node:fs')
const MANIFEST_PATH = 'package/git-policy/cli/package.json' const ZERO_SHA = '0000000000000000000000000000000000000000' const currentManifest = JSON.parse(readFileSync(MANIFEST_PATH, 'utf8')) const currentVersion = currentManifest.version const isManual = process.env.EVENT_NAME === 'workflow_dispatch' const baseSha = process.env.BASE_SHA ?? '' const outputPath = process.env.GITHUB_OUTPUT
if (typeof currentVersion !== 'string') throw new Error(`${MANIFEST_PATH} does not contain a string version`) if (!isManual && (baseSha === '' || baseSha === ZERO_SHA)) throw new Error('Automated version-bump detection requires a base revision') if (outputPath === undefined) throw new Error('GitHub did not provide GITHUB_OUTPUT')
const previousManifest = isManual ? currentManifest : JSON.parse(execFileSync( 'git', ['show', `${baseSha}:${MANIFEST_PATH}`], { encoding: 'utf8', }, )) const previousVersion = previousManifest.version if (typeof previousVersion !== 'string') throw new Error(`Base ${MANIFEST_PATH} does not contain a string version`)
const shouldRun = isManual || previousVersion !== currentVersion console.log(`cli-git version ${previousVersion} -> ${currentVersion}; benchmark=${String(shouldRun)}`) appendFileSync(outputPath, `should_run=${String(shouldRun)}\n`)
lifecycle-latency: needs: detect-version-bump if: ${{ needs.detect-version-bump.outputs.should_run == 'true' }} runs-on: ubuntu-latest env: MISE_AUTO_INSTALL: 'false' steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with: fetch-depth: 1
- name: Set up mise without repository-wide tool installation uses: jdx/mise-action@c2a87611a18de5b3828c5652fe268e992400cb5c with: # Resolve "latest" through the GitHub releases API, published releases only, # one day old like pnpm's minimumReleaseAge. Without it the action installs # whatever mise.jdx.dev/VERSION names, which runs ahead of the GitHub release # (2025.8.19, 2026.9.3): doc/troubleshooting/mise-action-version-ahead-of-release.md minimum_release_age: 1d install: false
- name: Install benchmark tools run: mise install node pnpm
- name: Update package metadata run: sudo apt-get update
- name: Install Podman run: sudo apt-get install --yes podman
- name: Install cli-git dependency closure run: mise exec node pnpm -- pnpm install --frozen-lockfile --filter @monochromatic-dev/git-policy-cli...
- name: Enforce measured lifecycle budgets run: mise run //package/git-policy/cli:perf:lifecycle-latency
- name: Upload raw lifecycle samples uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with: name: cli-git-lifecycle-latency-${{ github.run_attempt }} path: package/git-policy/cli/dist/perf/lifecycle-latency.json if-no-files-found: error retention-days: 30