diff --git a/.github/workflows/ci-experimental.yml b/.github/workflows/ci-experimental.yml index 8422d5a88..9641691e3 100644 --- a/.github/workflows/ci-experimental.yml +++ b/.github/workflows/ci-experimental.yml @@ -88,6 +88,7 @@ jobs: timeout-minutes: 60 name: test-v2-${{ matrix.os }} + steps: - name: Checkout code uses: actions/checkout@v3 @@ -106,4 +107,8 @@ jobs: key: ${{ runner.os }}-vendor-modules-${{ steps.submodules.outputs.hash }} - name: Run tests - run: make V=1 LOG_LEVEL=DEBUG QUICK_AND_DIRTY_COMPILER=1 test2 testwakunode2 + run: | + if [ ${{ runner.os }} -eq ubuntu-latest ]; then + sudo docker run --rm -d -e POSTGRES_PASSWORD=test123 -p 5432:5432 postgres:9.6-alpine + fi + make V=1 LOG_LEVEL=DEBUG QUICK_AND_DIRTY_COMPILER=1 test2 testwakunode2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0a4e63ff..45d55b3ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,6 @@ jobs: v2: ${{ steps.filter.outputs.v2 }} legacy: ${{ steps.filter.outputs.legacy }} - build-v2: needs: changes if: ${{ needs.changes.outputs.v2 == 'true' || needs.changes.outputs.common == 'true' }} @@ -115,8 +114,15 @@ jobs: key: ${{ runner.os }}-vendor-modules-${{ steps.submodules.outputs.hash }} - name: Run tests - run: make V=1 LOG_LEVEL=DEBUG QUICK_AND_DIRTY_COMPILER=1 test2 testwakunode2 - + run: | + if [ ${{ runner.os }} == "Linux" ]; then + echo "AAAA " + sudo docker run --rm -d -e POSTGRES_PASSWORD=test123 -p 5432:5432 postgres:9.6-alpine + fi + echo "AAAA 1" + . env.sh + nim c -r -d:chronicles_log_level=WARN --verbosity=0 --hints=off --outdir=build ./tests/v2/waku_archive/test_driver_postgres.nim +#make V=1 LOG_LEVEL=DEBUG QUICK_AND_DIRTY_COMPILER=1 test2 testwakunode2 build-legacy: needs: changes diff --git a/Makefile b/Makefile index 6249fd44a..a210303d2 100644 --- a/Makefile +++ b/Makefile @@ -175,7 +175,7 @@ testcommon: | build deps testwaku2: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim test2 $(NIM_PARAMS) $(EXPERIMENTAL_PARAMS) waku.nims + $(ENV_SCRIPT) nim test2 -d:os=$(shell uname) $(NIM_PARAMS) $(EXPERIMENTAL_PARAMS) waku.nims wakunode2: | build deps librln echo -e $(BUILD_MSG) "build/$@" && \ diff --git a/tests/all_tests_v2.nim b/tests/all_tests_v2.nim index d2303c8f5..e5cce733f 100644 --- a/tests/all_tests_v2.nim +++ b/tests/all_tests_v2.nim @@ -19,9 +19,12 @@ import ./v2/waku_archive/test_retention_policy, ./v2/waku_archive/test_waku_archive -# TODO: add the postgres test when we can mock the database. -# The postgres tests now need a running postgresql database running locally. -# ./v2/waku_archive/test_driver_postgres, +const os* {.strdefine.} = "" +when os == "Linux": + # GitHub only supports container actions on Linux + # and we need to start a postgress database in a docker container + import + ./v2/waku_archive/test_driver_postgres # Waku store test suite import diff --git a/tests/docker-compose.yml b/tests/postgres-docker-compose.yml similarity index 99% rename from tests/docker-compose.yml rename to tests/postgres-docker-compose.yml index 14fcdb168..99f93e6ab 100644 --- a/tests/docker-compose.yml +++ b/tests/postgres-docker-compose.yml @@ -1,6 +1,5 @@ version: "3.8" - services: db: image: postgres:9.6-alpine