Skip to content

Commit 5faf453

Browse files
committed
Extract code coverage jobs into separate CI workflow
1 parent eb8b307 commit 5faf453

File tree

2 files changed

+56
-82
lines changed

2 files changed

+56
-82
lines changed

.github/workflows/coverage.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Code coverage
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- TDE_REL_17_STABLE
7+
8+
jobs:
9+
collect:
10+
name: Collect and upload
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- name: Clone repository
14+
uses: actions/checkout@v4
15+
with:
16+
submodules: recursive
17+
18+
- name: Install dependencies
19+
run: ci_scripts/ubuntu-deps.sh
20+
21+
- name: Build postgres
22+
run: ci_scripts/make-build.sh debug --enable-coverage
23+
24+
- name: Setup kmip and vault
25+
run: ci_scripts/setup-keyring-servers.sh
26+
27+
- name: Test postgres with TDE to generate coverage
28+
run: ci_scripts/make-test-tde.sh --continue --tde-only
29+
30+
- name: Collect coverage data
31+
run: find . -type f -name "*.c" ! -path '*libkmip*' | xargs -t gcov -abcfu
32+
working-directory: contrib/pg_tde
33+
34+
- name: Upload coverage data to codecov.io
35+
uses: codecov/codecov-action@v5
36+
with:
37+
verbose: true
38+
token: ${{ secrets.CODECOV_TOKEN }}
39+
working-directory: contrib/pg_tde
40+
files: "*.c.gcov"
41+
42+
- name: Report on test fail
43+
uses: actions/upload-artifact@v4
44+
if: ${{ failure() }}
45+
with:
46+
name: coverage-testlog-tde
47+
path: |
48+
build/testrun/
49+
contrib/pg_tde/t/
50+
contrib/pg_tde/results
51+
contrib/pg_tde/regression.diffs
52+
contrib/pg_tde/regression.out
53+
contrib/pg_tde/*.gcov
54+
retention-days: 3
55+
56+

.github/workflows/psp-reusable.yml

-82
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ on:
1414

1515
env:
1616
artifact_name: build-${{ inputs.os }}-${{ inputs.build_script }}-${{ inputs.build_type }}
17-
coverage_artifact_name: coverage-build-${{ inputs.os }}-${{ inputs.build_script }}-${{ inputs.build_type }}
1817

1918
jobs:
2019
build:
@@ -46,36 +45,6 @@ jobs:
4645
artifacts.tar
4746
retention-days: 1
4847

49-
build-coverage:
50-
name: Build PSP for Coverage
51-
runs-on: ${{ inputs.os }}
52-
if: inputs.build_script == 'make' && inputs.build_type == 'debug'
53-
steps:
54-
- name: Clone repository
55-
uses: actions/checkout@v4
56-
with:
57-
path: 'src'
58-
submodules: recursive
59-
ref: ${{ github.ref }}
60-
61-
- name: Install dependencies
62-
run: src/ci_scripts/ubuntu-deps.sh
63-
64-
- name: Build postgres
65-
run: src/ci_scripts/${{ inputs.build_script }}-build.sh ${{ inputs.build_type }} --enable-coverage
66-
67-
- name: Archive pginst to artifact tar file
68-
run: tar -czf coverage-artifacts.tar src pginst
69-
70-
- name: Upload build coverage-artifacts
71-
uses: actions/upload-artifact@v4
72-
with:
73-
name: ${{ env.coverage_artifact_name }}
74-
overwrite: true
75-
path: |
76-
coverage-artifacts.tar
77-
retention-days: 1
78-
7948
test:
8049
name: Test PSP
8150
runs-on: ${{ inputs.os }}
@@ -150,54 +119,3 @@ jobs:
150119
src/contrib/*/regression.diffs
151120
src/contrib/*/regression.out
152121
retention-days: 3
153-
154-
test_tde_coverage:
155-
name: Generate Codecov Code Coverage
156-
runs-on: ${{ inputs.os }}
157-
if: inputs.build_script == 'make' && inputs.build_type == 'debug'
158-
needs: build
159-
160-
steps:
161-
- name: Download build coverage-artifacts
162-
uses: actions/download-artifact@v4
163-
with:
164-
name: ${{ env.coverage_artifact_name }}
165-
path: .
166-
167-
- name: Extract artifact file
168-
run: tar -xzf coverage-artifacts.tar
169-
170-
- name: Install dependencies
171-
run: src/ci_scripts/ubuntu-deps.sh
172-
173-
- name: Setup kmip and vault
174-
run: src/ci_scripts/setup-keyring-servers.sh
175-
176-
- name: Test postgres with TDE to generate coverage
177-
run: src/ci_scripts/${{ inputs.build_script }}-test-tde.sh --continue --tde-only
178-
179-
- name: Run code coverage
180-
run: find src/ -type f -name "*.c" ! -path '*libkmip*' | xargs -t gcov -abcfu
181-
working-directory: src/contrib/pg_tde
182-
183-
- name: Upload coverage data to codecov.io
184-
uses: codecov/codecov-action@v5
185-
with:
186-
verbose: true
187-
token: ${{ secrets.CODECOV_TOKEN }}
188-
working-directory: src/contrib/pg_tde
189-
files: "*.c.gcov"
190-
191-
- name: Report on test fail
192-
uses: actions/upload-artifact@v4
193-
if: ${{ failure() }}
194-
with:
195-
name: coverage-testlog-tde-${{ inputs.os }}-${{ inputs.build_script }}-${{ inputs.build_type }}
196-
path: |
197-
src/build/testrun/
198-
src/contrib/pg_tde/t/
199-
src/contrib/pg_tde/results
200-
src/contrib/pg_tde/regression.diffs
201-
src/contrib/pg_tde/regression.out
202-
src/contrib/pg_tde/*.gcov
203-
retention-days: 3

0 commit comments

Comments
 (0)