Skip to content

[TICKET-PR] DEV.setup: Users should not need to also install internally used dependencies #13

[TICKET-PR] DEV.setup: Users should not need to also install internally used dependencies

[TICKET-PR] DEV.setup: Users should not need to also install internally used dependencies #13

name: Central Blocks CI
on:
# --------------------------------------------------------------------
# 1. This lets user apps that use dev.setup library call this workflow
# --------------------------------------------------------------------
workflow_call:
inputs:
run_tests:
type: boolean
default: true # special treatment for npm test though it's not the only compulsory one
extra_scripts:
description: 'Additional npm scripts to run from user app (e.g., "build", "e2e")'
type: string
default: '' # Default to nothing
# ------------------------------------------------------
# 2. dev.setup library will check ITSELF on these events
# ------------------------------------------------------
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
validate:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['20.x', '21.x', '22.x', '23.x', '24.x', '25.x']
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
# Shared: Runs for both shared library and user app
- run: npm install
- run: npm run eslint:lint
# Shared & Compulsory: Standard Test - Runs for both library and user app if script exists
- name: Run Tests
# Logic: Run if specifically requested via input OR if running internally on library push/PR
if: ${{ inputs.run_tests || github.event_name != 'workflow_call' }}
run: npm run jest:test --if-present
# The plug-in step: Runs whatever the user app sent over
- name: Run Extra Scripts
if: ${{ inputs.extra_scripts != '' }}
run: |
for script in ${{ inputs.extra_scripts }}; do
npm run $script --if-present
done