Add UNIQUE constraint to 'name' columns #1
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: Coverage CPP/Python Tests | |
on: [push] | |
concurrency: | |
group: ci-${{github.ref}}-coverage-py-tests | |
cancel-in-progress: true | |
jobs: | |
coverage_tests: | |
if: github.repository == 'MerginMaps/geodiff' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Geodiff | |
uses: actions/checkout@v3 | |
- name: install deps | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y lcov | |
sudo apt-get install libpq-dev | |
sudo apt-get install postgresql-14 postgresql-contrib-14 postgresql-14-postgis-3 postgresql-common postgis | |
sudo apt-get install -y python3 python3-pytest libsqlite3-dev cmake cmake-data | |
- name: start PG database | |
run: | | |
sudo pg_ctlcluster 14 main start | |
sudo pg_lsclusters | |
- name: create PG user | |
run: | | |
sudo runuser -l postgres -c 'echo -e "geodiffpass\ngeodiffpass" | createuser -P -e geodiffuser' | |
sudo runuser -l postgres -c 'psql -c "CREATE DATABASE geodiffdb"' | |
sudo runuser -l postgres -c 'psql -d "geodiffdb" -c "CREATE EXTENSION postgis;"' | |
sudo runuser -l postgres -c 'psql -d "geodiffdb" -c "CREATE EXTENSION \"uuid-ossp\";"' | |
sudo runuser -l postgres -c 'psql -c "GRANT ALL PRIVILEGES ON DATABASE geodiffdb TO geodiffuser"' | |
# second database, to test diffs between different databases and same schemas, | |
# see https://github.com/MerginMaps/geodiff/issues/185 | |
sudo runuser -l postgres -c 'psql -c "CREATE DATABASE geodiffdb2"' | |
sudo runuser -l postgres -c 'psql -d "geodiffdb2" -c "CREATE EXTENSION postgis;"' | |
sudo runuser -l postgres -c 'psql -d "geodiffdb2" -c "CREATE EXTENSION \"uuid-ossp\";"' | |
sudo runuser -l postgres -c 'psql -c "GRANT ALL PRIVILEGES ON DATABASE geodiffdb2 TO geodiffuser"' | |
- name: build geodiff with coverage | |
run: | | |
mkdir -p build_coverage_lnx | |
cd build_coverage_lnx | |
cmake \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DENABLE_TESTS=ON \ | |
-DENABLE_COVERAGE=ON \ | |
-DWITH_POSTGRESQL=TRUE \ | |
../geodiff | |
make -j`nproc` | |
- name: Run tests | |
env: | |
CTEST_TARGET_SYSTEM: Linux-gcc | |
GEODIFF_PG_CONNINFO: "host=localhost port=5432 user=geodiffuser password=geodiffpass dbname=geodiffdb" | |
GEODIFF_PG_CONNINFO2: "host=localhost port=5432 user=geodiffuser password=geodiffpass dbname=geodiffdb2" | |
run: | | |
cd build_coverage_lnx | |
ctest -VV | |
- name: Run python tests | |
run: | | |
GEODIFFLIB=`pwd`/build_coverage_lnx/libgeodiff.so \ | |
GEODIFFCLI=`pwd`/build_coverage_lnx/geodiff \ | |
pytest-3 pygeodiff/ | |
- name: Prepare coverage report | |
run: | | |
cd build_coverage_lnx | |
lcov --directory . --capture --output-file coverage.info | |
lcov --remove coverage.info '*/tests/*' '/usr/*' '*googletest/*' '*/3rdparty/*' --output-file coverage.info | |
lcov --list coverage.info | |
- name: Coveralls | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: build_coverage_lnx/coverage.info |