Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this also have a --continue flag? Otherwise a failing test will also result in a lower coverage, because the test stops early.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you talking about make-test, not make-build. If some test failed coverage report would not be uploaded at all (and should not). As I understood --keep-going option in make is needed for situation where we have target A that depends on targets B and C, and if B failed with keep-going option make still will execute C. If that's how it work then it's redundant here as we run only pg-tde tests here, am I wrong?


- 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.sh --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


86 changes: 2 additions & 84 deletions .github/workflows/psp-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -135,8 +104,8 @@ jobs:
- name: Setup kmip and vault
run: src/ci_scripts/setup-keyring-servers.sh

- name: Test postgres with TDE
run: src/ci_scripts/${{ inputs.build_script }}-test-tde.sh --continue
- name: Test postgres with TDE as default access method
run: src/ci_scripts/${{ inputs.build_script }}-test-global-tde.sh --continue

- name: Report on test fail
uses: actions/upload-artifact@v4
Expand All @@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![codecov](https://codecov.io/github/percona/postgres/graph/badge.svg?token=Wow78BMYdP)](https://codecov.io/github/percona/postgres)
### Code coverage for [pg_tde](https://github.com/percona/postgres/tree/TDE_REL_17_STABLE/contrib/pg_tde): [![codecov](https://codecov.io/github/percona/postgres/graph/badge.svg?token=Wow78BMYdP)](https://codecov.io/github/percona/postgres)

Percona Server for PostgreSQL
=============================
Expand Down
File renamed without changes.
19 changes: 19 additions & 0 deletions ci_scripts/make-test-global-tde.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -e
ADD_FLAGS=

for arg in "$@"
do
case "$arg" in
--continue)
ADD_FLAGS="-k"
shift;;
esac
done

SCRIPT_DIR="$(cd -- "$(dirname "$0")" >/dev/null 2>&1; pwd -P)"
source $SCRIPT_DIR/env.sh
source $SCRIPT_DIR/configure-global-tde.sh

EXTRA_REGRESS_OPTS="--extra-setup=$SCRIPT_DIR/tde_setup.sql" make -s installcheck-world $ADD_FLAGS
30 changes: 0 additions & 30 deletions ci_scripts/make-test-tde.sh

This file was deleted.

23 changes: 20 additions & 3 deletions ci_scripts/make-test.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
#!/bin/bash

set -e
TDE_ONLY=0

for arg in "$@"
do
case "$arg" in
--tde-only)
TDE_ONLY=1
shift;;
esac
done

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
1 change: 1 addition & 0 deletions contrib/pg_tde/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ src/libkmip/libkmip/src/kmip_memset.o

SCRIPTS_built = src/pg_tde_change_key_provider

EXTRA_INSTALL+=contrib/pg_buffercache contrib/test_decoding
EXTRA_CLEAN += src/pg_tde_change_key_provider.o

ifdef USE_PGXS
Expand Down
1 change: 1 addition & 0 deletions contrib/pg_tde/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/percona/pg_tde/badge)](https://scorecard.dev/viewer/?uri=github.com/percona/pg_tde)
[![codecov](https://codecov.io/github/percona/postgres/graph/badge.svg?token=Wow78BMYdP)](https://codecov.io/github/percona/postgres)
[![Forum](https://img.shields.io/badge/Forum-join-brightgreen)](https://forums.percona.com/)

# pg_tde: Transparent Database Encryption for PostgreSQL
Expand Down