-
Notifications
You must be signed in to change notification settings - Fork 36
107 lines (92 loc) · 3.65 KB
/
code_coverage.yml
File metadata and controls
107 lines (92 loc) · 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: pgactive code coverage CI
on:
workflow_dispatch:
jobs:
test:
defaults:
run:
shell: sh
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
version: [
REL_18_STABLE,
REL_17_STABLE,
REL_16_STABLE,
REL_15_STABLE,
REL_14_STABLE,
REL_13_STABLE
]
runs-on: ${{ matrix.os }}
timeout-minutes: 120
steps:
- name: Checkout pgactive
uses: actions/checkout@v4
with:
path: pgactive
- name: Checkout Postgres
run: |
sudo apt-get -y -q install libipc-run-perl lcov build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc ccache pkg-config libicu-dev
git clone --depth 1 --branch ${{ matrix.version }} https://github.com/postgres/postgres.git
- name: Build Postgres
run: |
cd postgres
sh configure --prefix=$PWD/inst/ --enable-debug --enable-cassert --enable-tap-tests --enable-coverage CFLAGS="-ggdb3 -O0"
make -j4 install
# Install extensions required for pgactive tests
make -C contrib/btree_gist install
make -C contrib/cube install
make -C contrib/hstore install
make -C contrib/pg_trgm install
- name: Build pgactive
run: |
cd pgactive
PATH=$GITHUB_WORKSPACE/postgres/inst/bin:"$PATH"
sh configure
make PROFILE="-Wall -Wmissing-prototypes -Werror=maybe-uninitialized -Werror" -j4 all install
- name: Run pgactive core tests
run: |
cd pgactive
make regress_check
- name: Show pgactive core tests diff
if: ${{ failure() }}
run: |
cat pgactive/test/regression.diffs
- name: Run pgactive extended tests
run: |
cd pgactive
make PROVE_FLAGS="--timer -v" prove_check
- name: Upload test artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: test-artifact-${{ matrix.os }}-${{ matrix.version }}
path: |
pgactive/test/regression.diffs
pgactive/test/tmp_check/log
retention-days: 7
- name: Collect code coverage info
if: ${{ always() }}
run: |
# The steps to run code coverage are referred from
# https://www.postgresql.org/message-id/CAB7nPqQkUyN_A88Rw4iAaYax%3Dm4DwNPwoScBVyb3ihmfks8uDg%40mail.gmail.com
# and https://www.postgresql.org/docs/current/regress-coverage.html
cd pgactive
make coverage-html abs_top_srcdir=$(pwd)
/usr/bin/lcov --gcov-tool /usr/bin/gcov -q --no-external -c -i -d . -d ./ -o lcov_base.info
/usr/bin/lcov --gcov-tool /usr/bin/gcov -q --no-external -c -d . -d ./ -o lcov_test.info
rm -rf coverage
/usr/bin/genhtml --legend -o coverage-${{ matrix.version }} --title='pgactive on ${{ matrix.version }}' --num-spaces=4 lcov_base.info lcov_test.info
# Clean up steps. They are here as demonstration for developers
# running code coverage indvidually.
# rm -rf coverage coverage-${{ matrix.version }} coverage-html-stamp
# rm -f src/*.gcda src/*.gcno src/lcov*.info src/*.gcov src/.*.gcov src/*.gcov.out lcov_base.info lcov_test.info
- name: Upload code coverage artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: code-coverage-artifact-${{ matrix.os }}-${{ matrix.version }}
path: |
pgactive/coverage-${{ matrix.version }}
retention-days: 7