From fc93af17d310daf0265e333513706ef766e299ce Mon Sep 17 00:00:00 2001 From: Delega Bot Date: Tue, 14 Apr 2026 15:08:09 -0500 Subject: [PATCH] ci: extract reusable test workflow; ci.yml and publish.yml call it Same dedup pattern as delega-python#9 and delega-mcp#19. - Create .github/workflows/test.yml (workflow_call) covering npm ci + tsc --noEmit + npm run build. - ci.yml has one job that calls the reusable. - publish.yml's test job now calls the reusable, then publish + release continue unchanged (needs: test). Version-match-to-tag stays inline in publish.yml. Closes #23. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/ci.yml | 21 ++++----------------- .github/workflows/publish.yml | 9 ++++++--- .github/workflows/test.yml | 27 +++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbdea73..84813ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,20 +7,7 @@ on: branches: [main] jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 - with: - node-version: 24 - cache: npm - - - run: npm ci - - - name: Type check - run: npx tsc --noEmit - - - name: Build - run: npm run build + test: + # Install + typecheck + build come from the reusable workflow so + # ci.yml and publish.yml can't drift apart. + uses: ./.github/workflows/test.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 31f73a4..a3dbef5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,7 +9,13 @@ permissions: contents: write jobs: + test: + # Install + typecheck + build come from the reusable workflow. + # Same source as ci.yml so the two gates can't drift apart. + uses: ./.github/workflows/test.yml + publish: + needs: test runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -24,9 +30,6 @@ jobs: - run: npm ci - - name: Type check - run: npx tsc --noEmit - - name: Build run: npm run build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..5baf6fd --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: Test + +# Reusable workflow called by ci.yml (PR gate) and publish.yml (tag gate). +# Single source of truth for install + typecheck + build. If a tool version +# or script name changes, update this file only — both callers pick it up. + +on: + workflow_call: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 + with: + node-version: 24 + cache: npm + + - run: npm ci + + - name: Type check + run: npx tsc --noEmit + + - name: Build + run: npm run build