diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000000..965c60a3e8f --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,56 @@ +name: Code coverage +on: + pull_request: + push: + branches: + - TDE_REL_17_STABLE + +jobs: + collect: + name: Collect and upload + runs-on: ubuntu-22.04 + steps: + - name: Clone repository + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install dependencies + run: ci_scripts/ubuntu-deps.sh + + - name: Build postgres + run: ci_scripts/make-build.sh debug --enable-coverage + + - name: Setup kmip and vault + run: ci_scripts/setup-keyring-servers.sh + + - name: Test postgres with TDE to generate coverage + run: ci_scripts/make-test-tde.sh --continue --tde-only + + - name: Collect coverage data + run: find . -type f -name "*.c" ! -path '*libkmip*' | xargs -t gcov -abcfu + working-directory: contrib/pg_tde + + - name: Upload coverage data to codecov.io + uses: codecov/codecov-action@v5 + with: + verbose: true + token: ${{ secrets.CODECOV_TOKEN }} + working-directory: contrib/pg_tde + files: "*.c.gcov" + + - name: Report on test fail + uses: actions/upload-artifact@v4 + if: ${{ failure() }} + with: + name: coverage-testlog-tde + path: | + build/testrun/ + contrib/pg_tde/t/ + contrib/pg_tde/results + contrib/pg_tde/regression.diffs + contrib/pg_tde/regression.out + contrib/pg_tde/*.gcov + retention-days: 3 + + diff --git a/.github/workflows/psp-reusable.yml b/.github/workflows/psp-reusable.yml index a851a1d0176..554ae6c738c 100644 --- a/.github/workflows/psp-reusable.yml +++ b/.github/workflows/psp-reusable.yml @@ -14,7 +14,6 @@ on: env: artifact_name: build-${{ inputs.os }}-${{ inputs.build_script }}-${{ inputs.build_type }} - coverage_artifact_name: coverage-build-${{ inputs.os }}-${{ inputs.build_script }}-${{ inputs.build_type }} jobs: build: @@ -46,36 +45,6 @@ jobs: artifacts.tar retention-days: 1 - build-coverage: - name: Build PSP for Coverage - runs-on: ${{ inputs.os }} - if: inputs.build_script == 'make' && inputs.build_type == 'debug' - steps: - - name: Clone repository - uses: actions/checkout@v4 - with: - path: 'src' - submodules: recursive - ref: ${{ github.ref }} - - - name: Install dependencies - run: src/ci_scripts/ubuntu-deps.sh - - - name: Build postgres - run: src/ci_scripts/${{ inputs.build_script }}-build.sh ${{ inputs.build_type }} --enable-coverage - - - name: Archive pginst to artifact tar file - run: tar -czf coverage-artifacts.tar src pginst - - - name: Upload build coverage-artifacts - uses: actions/upload-artifact@v4 - with: - name: ${{ env.coverage_artifact_name }} - overwrite: true - path: | - coverage-artifacts.tar - retention-days: 1 - test: name: Test PSP runs-on: ${{ inputs.os }} @@ -150,54 +119,3 @@ jobs: src/contrib/*/regression.diffs src/contrib/*/regression.out retention-days: 3 - - test_tde_coverage: - name: Generate Codecov Code Coverage - runs-on: ${{ inputs.os }} - if: inputs.build_script == 'make' && inputs.build_type == 'debug' - needs: build - - steps: - - name: Download build coverage-artifacts - uses: actions/download-artifact@v4 - with: - name: ${{ env.coverage_artifact_name }} - path: . - - - name: Extract artifact file - run: tar -xzf coverage-artifacts.tar - - - name: Install dependencies - run: src/ci_scripts/ubuntu-deps.sh - - - name: Setup kmip and vault - run: src/ci_scripts/setup-keyring-servers.sh - - - name: Test postgres with TDE to generate coverage - run: src/ci_scripts/${{ inputs.build_script }}-test-tde.sh --continue --tde-only - - - name: Run code coverage - run: find src/ -type f -name "*.c" ! -path '*libkmip*' | xargs -t gcov -abcfu - working-directory: src/contrib/pg_tde - - - name: Upload coverage data to codecov.io - uses: codecov/codecov-action@v5 - with: - verbose: true - token: ${{ secrets.CODECOV_TOKEN }} - working-directory: src/contrib/pg_tde - files: "*.c.gcov" - - - name: Report on test fail - uses: actions/upload-artifact@v4 - if: ${{ failure() }} - with: - name: coverage-testlog-tde-${{ inputs.os }}-${{ inputs.build_script }}-${{ inputs.build_type }} - path: | - src/build/testrun/ - src/contrib/pg_tde/t/ - src/contrib/pg_tde/results - src/contrib/pg_tde/regression.diffs - src/contrib/pg_tde/regression.out - src/contrib/pg_tde/*.gcov - retention-days: 3 diff --git a/ci_scripts/make-test.sh b/ci_scripts/make-test.sh index 52c0aa58670..d82574d3ab6 100755 --- a/ci_scripts/make-test.sh +++ b/ci_scripts/make-test.sh @@ -4,6 +4,11 @@ SCRIPT_DIR="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)" INSTALL_DIR="$SCRIPT_DIR/../../pginst" source $SCRIPT_DIR/env.sh -cd "$SCRIPT_DIR/.." - -make -s check-world +if [ "$TDE_ONLY" -eq 1 ]; +then + cd "$SCRIPT_DIR/../contrib/pg_tde" + make -s check +else + cd "$SCRIPT_DIR/.." + make -s check-world +fi