forked from babelfish-for-postgresql/babelfish_extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
169 lines (147 loc) · 6.43 KB
/
code-coverage.yml
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: Code Coverage
on:
schedule:
- cron: '0 0 * * *' # runs every midnight
jobs:
run-code-coverage-tests:
runs-on: ubuntu-20.04
env:
INSTALL_DIR: psql
steps:
- uses: actions/checkout@v2
id: checkout
- name: Install Dependencies
id: install-dependencies
if: always()
uses: ./.github/composite-actions/install-dependencies
- name: Build Modified Postgres
id: build-modified-postgres
if: always() && steps.install-dependencies.outcome == 'success'
uses: ./.github/composite-actions/build-modified-postgres
with:
install_dir: ${{env.INSTALL_DIR}}
code_coverage: 'yes'
- name: Compile ANTLR
id: compile-antlr
if: always() && steps.build-modified-postgres.outcome == 'success'
uses: ./.github/composite-actions/compile-antlr
with:
install_dir: ${{env.INSTALL_DIR}}
- name: Build Extensions
id: build-extensions
if: always() && steps.compile-antlr.outcome == 'success'
uses: ./.github/composite-actions/build-extensions
with:
install_dir: ${{env.INSTALL_DIR}}
- name: Build tds_fdw Extension
id: build-tds_fdw-extension
if: always() && steps.build-extensions.outcome == 'success'
uses: ./.github/composite-actions/build-tds_fdw-extension
- name: Build vector Extension
id: build-vector-extension
if: always() && steps.build-tds_fdw-extension.outcome == 'success'
uses: ./.github/composite-actions/build-vector-extension
- name: Build PostGIS Extension
id: build-postgis-extension
if: always() && steps.build-vector-extension.outcome == 'success'
uses: ./.github/composite-actions/build-postgis-extension
- name: Install Extensions
id: install-extensions
if: always() && steps.build-extensions.outcome == 'success'
uses: ./.github/composite-actions/install-extensions
with:
install_dir: ${{env.INSTALL_DIR}}
- name: Run JDBC Tests
id: run-jdbc-tests
if: always() && steps.install-extensions.outcome == 'success'
timeout-minutes: 60
uses: ./.github/composite-actions/run-jdbc-tests
- name: Run Dotnet Tests
id: install-and-run-dotnet
if: always() && steps.install-extensions.outcome == 'success'
uses: ./.github/composite-actions/install-and-run-dotnet
- name: Run ODBC Tests
id: install-and-run-odbc-tests
if: always() && steps.install-extensions.outcome == 'success'
uses: ./.github/composite-actions/install-and-run-odbc
- name: Drop and re-create Babelfish database
id: re-install-extensions
if: always() && steps.install-extensions.outcome == 'success'
run: |
sudo ~/psql/bin/psql -d postgres -U runner -v user="jdbc_user" -v db="jdbc_testdb" -f .github/scripts/cleanup_babelfish_database.sql
sudo ~/psql/bin/psql -v ON_ERROR_STOP=1 -d postgres -U runner -v user="jdbc_user" -v db="jdbc_testdb" -v migration_mode="multi-db" -v tsql_port=1433 -v parallel_query_mode=false -f .github/scripts/create_extension.sql
sqlcmd -S localhost -U "jdbc_user" -P 12345678 -Q "SELECT @@version GO"
- name: Run Python Tests
id: install-and-run-python
if: always() && steps.re-install-extensions.outcome == 'success'
uses: ./.github/composite-actions/install-and-run-python
- name: Generate code coverage HTML report
id: code-coverage
if: always()
run: |
export PG_CONFIG=~/psql/bin/pg_config
export PG_SRC=~/work/postgresql_modified_for_babelfish
export cmake=$(which cmake)
cd contrib
for ext in babelfishpg_common babelfishpg_money babelfishpg_tds babelfishpg_tsql
do
cd $ext
/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 -q --legend -o coverage --title='$ext' --ignore-errors source --num-spaces=4 lcov_base.info lcov_test.info
touch coverage-html-stamp
cd ..
done
shell: bash
- name: Summarize code coverage
id: code-coverage-summary
if: always()
run: |
cd contrib/
lcov -a babelfishpg_tsql/lcov_test.info -a babelfishpg_tds/lcov_test.info -a babelfishpg_common/lcov_test.info -a babelfishpg_money/lcov_test.info -o lcov.info
lcov --list lcov.info
- name: Upload Coverage Report for babelfishpg_tsql extension
if: always()
uses: actions/upload-artifact@v3
with:
name: coverage_tsql_${{github.ref_name}}
path: contrib/babelfishpg_tsql/coverage/
- name: Upload Coverage Report for babelfishpg_tds extension
if: always()
uses: actions/upload-artifact@v3
with:
name: coverage_tds_${{github.ref_name}}
path: contrib/babelfishpg_tds/coverage/
- name: Upload Coverage Report for babelfishpg_common extension
if: always()
uses: actions/upload-artifact@v3
with:
name: coverage_common_${{github.ref_name}}
path: contrib/babelfishpg_common/coverage/
- name: Upload Coverage Report for babelfishpg_money extension
if: always()
uses: actions/upload-artifact@v3
with:
name: coverage_money_${{github.ref_name}}
path: contrib/babelfishpg_money/coverage/
- name: Download CSV report from previous run
if: (github.event_name == 'schedule')
uses: dawidd6/action-download-artifact@v2
with:
name: csv_${{github.ref_name}}
path: contrib/
search_artifacts: true
if_no_artifact_found: warn
- name: Add latest coverage numbers to CSV file
if: (github.event_name == 'schedule')
run: |
cd contrib/
paste -s -d, <(date +"%m/%d/%Y %H:%M:%S";lcov --summary lcov.info | grep -Po "[0-9]+\.[0-9]*") >> ${{github.ref_name}}.csv
shell: bash
- name: Upload CSV report with latest coverage numbers
if: (github.event_name == 'schedule')
uses: actions/upload-artifact@v3
with:
name: csv_${{github.ref_name}}
path: contrib/${{github.ref_name}}.csv