name: Central CI on: workflow_call: inputs: run_build: type: string required: true run_quality: type: string required: true run_deploy: type: string required: true wait_for_quality_gate: type: string required: false tech_stack: type: string required: true app_path_beta: type: string required: false app_path_staging: type: string required: false app_path_prod: type: string required: false build_command: type: string required: false pm2_id: type: string required: false secrets: SONARQUBE_HOST: required: false SONARQUBE_TOKEN: required: false BETA_SERVER_HOST: required: false BETA_SERVER_PORT: required: false BETA_SERVER_USERNAME: required: false BETA_SERVER_PASSWORD: required: false BETA_SERVER_KEY: required: false STAGING_SERVER_HOST: required: false STAGING_SERVER_PORT: required: false STAGING_SERVER_USERNAME: required: false STAGING_SERVER_PASSWORD: required: false STAGING_SERVER_KEY: required: false PROD_SERVER_HOST: required: false PROD_SERVER_PORT: required: false PROD_SERVER_USERNAME: required: false PROD_SERVER_PASSWORD: required: false PROD_SERVER_KEY: required: false jobs: build: if: ${{ inputs.run_build == 'true' }} runs-on: ubuntu-latest steps: #region agent log - name: Debug input forwarding for build run: | curl -sS -X POST "http://127.0.0.1:7352/ingest/24143b9f-f549-4429-832c-d0515ce6e2ac" \ -H "Content-Type: application/json" \ -H "X-Debug-Session-Id: 0ae703" \ -d "{\"sessionId\":\"0ae703\",\"runId\":\"${{ github.run_id }}\",\"hypothesisId\":\"H1\",\"location\":\"wdipl-actions/.gitea/workflows/ci.yml:build\",\"message\":\"workflow_call flags at build\",\"data\":{\"run_build\":\"${{ inputs.run_build }}\",\"run_quality\":\"${{ inputs.run_quality }}\",\"run_deploy\":\"${{ inputs.run_deploy }}\"},\"timestamp\":$(date +%s000)}" || true #endregion - 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 [ -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: if: ${{ inputs.run_quality == 'true' }} uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/quality.yml@d604440af823c664b2c828a3d6a2cc5d23b79141 with: project_key: ${{ github.event.repository.name }} wait_for_quality_gate: ${{ inputs.wait_for_quality_gate }} secrets: SONARQUBE_HOST: ${{ secrets.SONARQUBE_HOST }} SONARQUBE_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} deploy: if: ${{ inputs.run_deploy == 'true' }} uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/deploy.yml@main with: tech_stack: ${{ inputs.tech_stack }} branch_name: ${{ github.ref_name }} pm2_id: ${{ inputs.pm2_id }} app_path_beta: ${{ inputs.app_path_beta }} app_path_staging: ${{ inputs.app_path_staging }} app_path_prod: ${{ inputs.app_path_prod }} secrets: BETA_SERVER_HOST: ${{ secrets.BETA_SERVER_HOST }} BETA_SERVER_PORT: ${{ secrets.BETA_SERVER_PORT }} BETA_SERVER_USERNAME: ${{ secrets.BETA_SERVER_USERNAME }} BETA_SERVER_PASSWORD: ${{ secrets.BETA_SERVER_PASSWORD }} BETA_SERVER_KEY: ${{ secrets.BETA_SERVER_KEY }} STAGING_SERVER_HOST: ${{ secrets.STAGING_SERVER_HOST }} STAGING_SERVER_PORT: ${{ secrets.STAGING_SERVER_PORT }} STAGING_SERVER_USERNAME: ${{ secrets.STAGING_SERVER_USERNAME }} STAGING_SERVER_PASSWORD: ${{ secrets.STAGING_SERVER_PASSWORD }} STAGING_SERVER_KEY: ${{ secrets.STAGING_SERVER_KEY }} PROD_SERVER_HOST: ${{ secrets.PROD_SERVER_HOST }} PROD_SERVER_PORT: ${{ secrets.PROD_SERVER_PORT }} PROD_SERVER_USERNAME: ${{ secrets.PROD_SERVER_USERNAME }} PROD_SERVER_PASSWORD: ${{ secrets.PROD_SERVER_PASSWORD }} PROD_SERVER_KEY: ${{ secrets.PROD_SERVER_KEY }} quality_gate_debug: if: ${{ always() }} needs: [build, sonar] runs-on: ubuntu-latest steps: #region agent log - name: Debug quality decision result run: | curl -sS -X POST "http://127.0.0.1:7352/ingest/24143b9f-f549-4429-832c-d0515ce6e2ac" \ -H "Content-Type: application/json" \ -H "X-Debug-Session-Id: 0ae703" \ -d "{\"sessionId\":\"0ae703\",\"runId\":\"${{ github.run_id }}\",\"hypothesisId\":\"H2\",\"location\":\"wdipl-actions/.gitea/workflows/ci.yml:quality_gate_debug\",\"message\":\"quality job outcome\",\"data\":{\"run_quality\":\"${{ inputs.run_quality }}\",\"build_result\":\"${{ needs.build.result }}\",\"sonar_result\":\"${{ needs.sonar.result }}\"},\"timestamp\":$(date +%s000)}" || true #endregion deploy_gate_debug: if: ${{ always() }} needs: [build, sonar, deploy] runs-on: ubuntu-latest steps: #region agent log - name: Debug deploy decision result run: | curl -sS -X POST "http://127.0.0.1:7352/ingest/24143b9f-f549-4429-832c-d0515ce6e2ac" \ -H "Content-Type: application/json" \ -H "X-Debug-Session-Id: 0ae703" \ -d "{\"sessionId\":\"0ae703\",\"runId\":\"${{ github.run_id }}\",\"hypothesisId\":\"H3\",\"location\":\"wdipl-actions/.gitea/workflows/ci.yml:deploy_gate_debug\",\"message\":\"deploy job outcome\",\"data\":{\"run_deploy\":\"${{ inputs.run_deploy }}\",\"build_result\":\"${{ needs.build.result }}\",\"sonar_result\":\"${{ needs.sonar.result }}\",\"deploy_result\":\"${{ needs.deploy.result }}\"},\"timestamp\":$(date +%s000)}" || true #endregion