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: MemCheck Tests | |
on: [push] | |
concurrency: | |
group: ci-${{github.ref}}-memcheck-tests | |
cancel-in-progress: true | |
jobs: | |
memcheck_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 libpq-dev | |
sudo apt-get install libc6-dbg gdb valgrind | |
sudo apt-get install postgresql-14 postgresql-contrib-14 postgresql-14-postgis-3 postgresql-common postgis | |
valgrind --version | |
- 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 valgrind | |
run: | | |
mkdir -p build_memcheck_lnx | |
cd build_memcheck_lnx | |
cmake \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DENABLE_TESTS=ON \ | |
-DMEMORYCHECK_COMMAND_OPTIONS="--leak-check=yes --show-leak-kinds=definite --gen-suppressions=all --track-origins=yes --num-callers=20 --leak-resolution=high --show-reachable=no" \ | |
-DMEMORYCHECK_SUPPRESSIONS_FILE=../scripts/ci/linux/valgrind.supp \ | |
-DWITH_POSTGRESQL=TRUE \ | |
../geodiff | |
make -j`nproc` | |
- name: Run tests | |
env: | |
CTEST_TARGET_SYSTEM: Linux-gcc | |
GLIBCPP_FORCE_NEW: 1 | |
GLIBCXX_FORCE_NEW: 1 | |
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_memcheck_lnx | |
ctest -T memcheck 2>&1 | tee memcheck.log | |
- name: Check memcheck for errors | |
run: | | |
cd build_memcheck_lnx | |
if grep -q "Defects:" "memcheck.log"; then | |
echo "Error: Show memcheck results" | |
ls -la Testing/Temporary/MemoryChecker.*.log | |
cat Testing/Temporary/MemoryChecker.*.log | |
exit 1 | |
fi |