Simplify central CI workflow while preserving runner-safe gating.
Remove unused inputs and the extra meta job, and keep a single stable flow where build snapshots ci_steps for sonar/deploy conditions. Made-with: Cursor
This commit is contained in:
@@ -3,12 +3,6 @@ name: Central CI
|
|||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
# 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.
|
|
||||||
# Tokens: build, sonar, deploy (e.g. build,sonar,deploy). No spaces — WDIPL-Runner has no replace().
|
|
||||||
# WDIPL-Runner: needs.meta.outputs is empty when evaluating sonar after a reusable child completes.
|
|
||||||
# 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
|
||||||
@@ -19,13 +13,9 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
# Variables
|
|
||||||
app_path_beta:
|
app_path_beta:
|
||||||
type: string
|
type: string
|
||||||
required: false
|
required: false
|
||||||
app_path_testing:
|
|
||||||
type: string
|
|
||||||
required: false
|
|
||||||
app_path_staging:
|
app_path_staging:
|
||||||
type: string
|
type: string
|
||||||
required: false
|
required: false
|
||||||
@@ -35,19 +25,9 @@ on:
|
|||||||
build_command:
|
build_command:
|
||||||
type: string
|
type: string
|
||||||
required: false
|
required: false
|
||||||
deploy_command:
|
|
||||||
type: string
|
|
||||||
required: false
|
|
||||||
runtime:
|
|
||||||
type: string
|
|
||||||
required: false
|
|
||||||
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:
|
||||||
SONARQUBE_HOST:
|
SONARQUBE_HOST:
|
||||||
@@ -89,26 +69,14 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
meta:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Capture ci_steps for later job if
|
|
||||||
id: snap
|
|
||||||
run: echo "cs=${{ inputs.ci_steps }}" >> "$GITHUB_OUTPUT"
|
|
||||||
outputs:
|
|
||||||
cs: ${{ steps.snap.outputs.cs }}
|
|
||||||
|
|
||||||
# 🔨 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},', inputs.ci_steps), ',build,') }}
|
||||||
needs: [meta]
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
cs: ${{ steps.capture.outputs.cs }}
|
cs: ${{ steps.capture.outputs.cs }}
|
||||||
steps:
|
steps:
|
||||||
- id: capture
|
- id: capture
|
||||||
name: Capture ci_steps for sonar/deploy if
|
name: Capture ci_steps
|
||||||
run: echo "cs=${{ inputs.ci_steps }}" >> "$GITHUB_OUTPUT"
|
run: echo "cs=${{ inputs.ci_steps }}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
@@ -123,10 +91,6 @@ 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"
|
||||||
@@ -137,10 +101,9 @@ jobs:
|
|||||||
npm run build
|
npm run build
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 🔍 SONAR
|
|
||||||
sonar:
|
sonar:
|
||||||
if: ${{ contains(format(',{0},', needs.build.outputs.cs), ',sonar,') }}
|
if: ${{ contains(format(',{0},', needs.build.outputs.cs), ',sonar,') }}
|
||||||
needs: [meta, build]
|
needs: [build]
|
||||||
uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/quality.yml@d604440af823c664b2c828a3d6a2cc5d23b79141
|
uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/quality.yml@d604440af823c664b2c828a3d6a2cc5d23b79141
|
||||||
with:
|
with:
|
||||||
project_key: ${{ github.event.repository.name }}
|
project_key: ${{ github.event.repository.name }}
|
||||||
@@ -149,10 +112,9 @@ jobs:
|
|||||||
SONARQUBE_HOST: ${{ secrets.SONARQUBE_HOST }}
|
SONARQUBE_HOST: ${{ secrets.SONARQUBE_HOST }}
|
||||||
SONARQUBE_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
|
SONARQUBE_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
|
||||||
|
|
||||||
# 🚀 DEPLOY (runs after build; sonar may be skipped)
|
|
||||||
deploy:
|
deploy:
|
||||||
if: ${{ always() && contains(format(',{0},', needs.build.outputs.cs), ',deploy,') && needs.build.result == 'success' && (needs.sonar.result == 'success' || needs.sonar.result == 'skipped') }}
|
if: ${{ always() && contains(format(',{0},', needs.build.outputs.cs), ',deploy,') && needs.build.result == 'success' && (needs.sonar.result == 'success' || needs.sonar.result == 'skipped') }}
|
||||||
needs: [meta, build, sonar]
|
needs: [build, sonar]
|
||||||
uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/deploy.yml@main
|
uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/deploy.yml@main
|
||||||
with:
|
with:
|
||||||
tech_stack: ${{ inputs.tech_stack }}
|
tech_stack: ${{ inputs.tech_stack }}
|
||||||
|
|||||||
Reference in New Issue
Block a user