From dbc32e5fad26ea962f3976b21c46ff848ddbef53 Mon Sep 17 00:00:00 2001 From: Satyaki Ghosh Date: Wed, 1 Oct 2025 12:32:21 -0600 Subject: [PATCH] Fix pr and ci workflow --- .github/workflows/build-and-test.yml | 24 ---------- .github/workflows/pr.yml | 66 ++++++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index d59a3ae7..57f456cf 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -25,9 +25,6 @@ jobs: uses: ./.github/workflows/configs.yml build-test-nodejs: - permissions: - contents: read - pull-requests: write needs: [get-configs] runs-on: ${{ inputs.runs-on }} steps: @@ -56,27 +53,6 @@ jobs: if: runner.os != 'Windows' run: npm run lint && npm run test - - name: Code Coverage - if: runner.os != 'Windows' && github.event_name == 'pull_request' - uses: irongut/CodeCoverageSummary@v1.3.0 - with: - filename: coverage/**/cobertura-coverage.xml - badge: false - fail_below_min: false - format: markdown - hide_branch_rate: false - hide_complexity: false - indicators: true - output: both - thresholds: '80 85' - - - name: Add Coverage PR Comment - if: runner.os != 'Windows' && github.event_name == 'pull_request' - uses: marocchino/sticky-pull-request-comment@v2 - with: - recreate: true - path: code-coverage-results.md - build-test-go: needs: [get-configs] runs-on: ${{ inputs.runs-on }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 059b350e..529511d9 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -5,10 +5,68 @@ on: branches: [ main ] jobs: - build-and-test: - uses: ./.github/workflows/build-and-test.yml + get-configs: + uses: ./.github/workflows/configs.yml + + pr-build-test-nodejs: + needs: [get-configs] + runs-on: ubuntu-latest permissions: contents: read pull-requests: write - with: - ref: ${{ github.sha }} + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js ${{ needs.get-configs.outputs.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ needs.get-configs.outputs.node-version }} + cache: 'npm' + + - name: Install Dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Lint and Test + run: npm run lint && npm run test + + - name: Code Coverage + uses: irongut/CodeCoverageSummary@v1.3.0 + with: + filename: coverage/**/cobertura-coverage.xml + badge: false + fail_below_min: false + format: markdown + hide_branch_rate: false + hide_complexity: false + indicators: true + output: both + thresholds: '80 85' + + - name: Add Coverage PR Comment + uses: marocchino/sticky-pull-request-comment@v2 + with: + recreate: true + path: code-coverage-results.md + + pr-build-test-go: + needs: [get-configs] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Go ${{ needs.get-configs.outputs.go-version }} + uses: actions/setup-go@v4 + with: + go-version: ${{ needs.get-configs.outputs.go-version }} + cache: true + + - name: Build + shell: bash + run: GOPROXY=direct go build -C ./cfn-init ./... + + - name: Test + shell: bash + run: GOPROXY=direct go test -C ./cfn-init -v -cover ./...