add coveralls support #87
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: JDBC Tests | |
on: [push, pull_request] | |
jobs: | |
run-babelfish-jdbc-tests: | |
env: | |
INSTALL_DIR: psql | |
runs-on: ubuntu-20.04 | |
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: | |
code_coverage: 'yes' | |
- name: Compile ANTLR | |
id: compile-antlr | |
if: always() && steps.build-modified-postgres.outcome == 'success' | |
uses: ./.github/composite-actions/compile-antlr | |
- name: Build Extensions | |
id: build-extensions | |
if: always() && steps.compile-antlr.outcome == 'success' | |
uses: ./.github/composite-actions/build-extensions | |
- 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 PostGIS Extension | |
id: build-postgis-extension | |
if: always() && steps.build-tds_fdw-extension.outcome == 'success' | |
uses: ./.github/composite-actions/build-postgis-extension | |
- name: Install Extensions | |
id: install-extensions | |
if: always() && steps.build-postgis-extension.outcome == 'success' | |
uses: ./.github/composite-actions/install-extensions | |
- name: Run JDBC Tests | |
id: jdbc | |
if: always() && steps.install-extensions.outcome == 'success' | |
timeout-minutes: 60 | |
uses: ./.github/composite-actions/run-jdbc-tests | |
- name: Cleanup babelfish database | |
id: cleanup | |
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 | |
- name: Upload Log | |
if: always() && steps.jdbc.outcome == 'failure' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: postgres-log | |
path: ~/psql/data/logfile | |
# The test summary files contain paths with ':' characters, which is not allowed with the upload-artifact actions | |
- name: Rename Test Summary Files | |
id: test-file-rename | |
if: always() && steps.jdbc.outcome == 'failure' | |
run: | | |
cd test/JDBC/Info | |
timestamp=`ls -Art | tail -n 1` | |
cd $timestamp | |
mv $timestamp.diff ../output-diff.diff | |
mv "$timestamp"_runSummary.log ../run-summary.log | |
- name: Upload Run Summary | |
if: always() && steps.test-file-rename == 'success' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: run-summary.log | |
path: test/JDBC/Info/run-summary.log | |
- name: Upload Output Diff | |
if: always() && steps.jdbc.outcome == 'failure' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: output-diff.diff | |
path: test/JDBC/Info/output-diff.diff | |
- name: Check and upload coredumps | |
if: always() && steps.jdbc.outcome == 'failure' | |
uses: ./.github/composite-actions/upload-coredump | |
- name: Generate Code Coverage | |
id: generate-code-coverage | |
if: always() && steps.jdbc.outcome == 'success' | |
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 -d . -d ./ -o lcov_test.info | |
cd .. | |
done | |
shell: bash | |
- name: Summarize code coverage | |
id: code-coverage-summary | |
if: always() && steps.generate-code-coverage.outcome == 'success' | |
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 jdbc-lcov.info | |
lcov --list jdbc-lcov.info | |
- name: Upload coverage to coveralls | |
if: always() && steps.code-coverage-summary.outcome == 'success' && github.event_name == 'pull_request' | |
uses: coverallsapp/github-action@v2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: $GITHUB_WORKSPACE/contrib/jdbc-lcov.info |