fix(ci): inline build job so sonar sees needs.build.outputs.cs
WDIPL-Runner does not propagate reusable workflow outputs to the parent; sonar if was false. Inline build mirrors meta output pattern. Add skip_node_compile for fast pipeline checks. Made-with: Cursor
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
# Standalone build workflow. Central CI inlines these steps in ci.yml because WDIPL-Runner
|
||||||
|
# does not forward reusable-workflow outputs to the parent reliably.
|
||||||
name: Build
|
name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -14,6 +16,9 @@ on:
|
|||||||
ci_steps:
|
ci_steps:
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
|
skip_node_compile:
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
cs:
|
cs:
|
||||||
@@ -40,6 +45,10 @@ jobs:
|
|||||||
- name: Build (Node / React / NestJS)
|
- name: Build (Node / React / NestJS)
|
||||||
if: inputs.tech_stack == 'node' || inputs.tech_stack == 'react' || inputs.tech_stack == 'nestjs'
|
if: inputs.tech_stack == 'node' || inputs.tech_stack == 'react' || inputs.tech_stack == 'nestjs'
|
||||||
run: |
|
run: |
|
||||||
|
if [ "${{ inputs.skip_node_compile }}" = "true" ]; then
|
||||||
|
echo "TEMP: skip npm install / npm run build (skip_node_compile=true)"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
if [ -n "${{ inputs.build_command }}" ]; then
|
if [ -n "${{ inputs.build_command }}" ]; then
|
||||||
set -xe
|
set -xe
|
||||||
echo "Running custom build command"
|
echo "Running custom build command"
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ on:
|
|||||||
# WDIPL-Runner v0.2.12: only the first truthy workflow_call flag reached nested jobs; the rest
|
# WDIPL-Runner v0.2.12: only the first truthy workflow_call flag reached nested jobs; the rest
|
||||||
# were empty. Use ONE comma-separated input so Act forwards a single string with all steps.
|
# were empty. Use ONE comma-separated input so Act forwards a single string with all steps.
|
||||||
# Tokens: build, sonar, deploy (e.g. build,sonar,deploy). No spaces — WDIPL-Runner has no replace().
|
# Tokens: build, sonar, deploy (e.g. build,sonar,deploy). No spaces — WDIPL-Runner has no replace().
|
||||||
# Runner drops inputs.ci_steps after the first reusable child; `meta` captures it. WDIPL-Runner then
|
# WDIPL-Runner: needs.meta.outputs is empty when evaluating sonar after a reusable child completes.
|
||||||
# clears needs.meta.outputs before sonar/deploy — pass the string into build.yml and use needs.build.outputs.cs.
|
# Reusable workflow outputs from build.yml did not surface as needs.build.outputs.cs. Inline `build` job
|
||||||
|
# below snapshots ci_steps into job outputs (same pattern as `meta`) so sonar/deploy see needs.build.outputs.cs.
|
||||||
ci_steps:
|
ci_steps:
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
@@ -43,6 +44,10 @@ on:
|
|||||||
pm2_id:
|
pm2_id:
|
||||||
type: string
|
type: string
|
||||||
required: false
|
required: false
|
||||||
|
# Set to 'true' to skip npm install / npm run build (temporary pipeline debugging).
|
||||||
|
skip_node_compile:
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
SONAR_HOST_URL:
|
SONAR_HOST_URL:
|
||||||
@@ -94,15 +99,43 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
cs: ${{ steps.snap.outputs.cs }}
|
cs: ${{ steps.snap.outputs.cs }}
|
||||||
|
|
||||||
# 🔨 BUILD
|
# 🔨 BUILD (inlined — reusable build.yml outputs are not exposed to this parent on WDIPL-Runner)
|
||||||
build:
|
build:
|
||||||
if: ${{ contains(format(',{0},', needs.meta.outputs.cs), ',build,') }}
|
if: ${{ contains(format(',{0},', needs.meta.outputs.cs), ',build,') }}
|
||||||
needs: [meta]
|
needs: [meta]
|
||||||
uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/build.yml@main
|
runs-on: ubuntu-latest
|
||||||
with:
|
outputs:
|
||||||
tech_stack: ${{ inputs.tech_stack }}
|
cs: ${{ steps.capture.outputs.cs }}
|
||||||
build_command: ${{ inputs.build_command }}
|
steps:
|
||||||
ci_steps: ${{ needs.meta.outputs.cs }}
|
- id: capture
|
||||||
|
name: Capture ci_steps for sonar/deploy if
|
||||||
|
run: echo "cs=${{ inputs.ci_steps }}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
if: inputs.tech_stack == 'node' || inputs.tech_stack == 'react' || inputs.tech_stack == 'nestjs'
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
|
||||||
|
- name: Build (Node / React / NestJS)
|
||||||
|
if: inputs.tech_stack == 'node' || inputs.tech_stack == 'react' || inputs.tech_stack == 'nestjs'
|
||||||
|
run: |
|
||||||
|
if [ "${{ inputs.skip_node_compile }}" = "true" ]; then
|
||||||
|
echo "TEMP: skip npm install / npm run build (skip_node_compile=true)"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ -n "${{ inputs.build_command }}" ]; then
|
||||||
|
set -xe
|
||||||
|
echo "Running custom build command"
|
||||||
|
${{ inputs.build_command }}
|
||||||
|
else
|
||||||
|
set -xe
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
fi
|
||||||
|
|
||||||
# 🔍 SONAR
|
# 🔍 SONAR
|
||||||
sonar:
|
sonar:
|
||||||
|
|||||||
Reference in New Issue
Block a user