Allow compile postgres tests only on Linux platforms (#1771)

This is needed because currently the GitHub Actions only supports
starting a docker container in a Linux runners.
This commit is contained in:
Ivan Folgueira Bande 2023-06-02 14:53:13 +02:00 committed by GitHub
parent 835a409d10
commit fcd7f33d9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 9 deletions

View File

@ -47,7 +47,6 @@ jobs:
common: ${{ steps.filter.outputs.common }} common: ${{ steps.filter.outputs.common }}
v2: ${{ steps.filter.outputs.v2 }} v2: ${{ steps.filter.outputs.v2 }}
build-v2: build-v2:
needs: changes needs: changes
if: ${{ needs.changes.outputs.v2 == 'true' || needs.changes.outputs.common == 'true' }} if: ${{ needs.changes.outputs.v2 == 'true' || needs.changes.outputs.common == 'true' }}
@ -88,6 +87,7 @@ jobs:
timeout-minutes: 60 timeout-minutes: 60
name: test-v2-${{ matrix.os }} name: test-v2-${{ matrix.os }}
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -106,4 +106,9 @@ jobs:
key: ${{ runner.os }}-vendor-modules-${{ steps.submodules.outputs.hash }} key: ${{ runner.os }}-vendor-modules-${{ steps.submodules.outputs.hash }}
- name: Run tests - name: Run tests
run: make V=1 LOG_LEVEL=DEBUG QUICK_AND_DIRTY_COMPILER=1 test2 testwakunode2 run: |
if [ ${{ runner.os }} == "Linux" ]; 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

View File

@ -56,7 +56,6 @@ jobs:
v2: ${{ steps.filter.outputs.v2 }} v2: ${{ steps.filter.outputs.v2 }}
legacy: ${{ steps.filter.outputs.legacy }} legacy: ${{ steps.filter.outputs.legacy }}
build-v2: build-v2:
needs: changes needs: changes
if: ${{ needs.changes.outputs.v2 == 'true' || needs.changes.outputs.common == 'true' }} if: ${{ needs.changes.outputs.v2 == 'true' || needs.changes.outputs.common == 'true' }}
@ -115,8 +114,12 @@ jobs:
key: ${{ runner.os }}-vendor-modules-${{ steps.submodules.outputs.hash }} key: ${{ runner.os }}-vendor-modules-${{ steps.submodules.outputs.hash }}
- name: Run tests - name: Run tests
run: make V=1 LOG_LEVEL=DEBUG QUICK_AND_DIRTY_COMPILER=1 test2 testwakunode2 run: |
if [ ${{ runner.os }} == "Linux" ]; 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
build-legacy: build-legacy:
needs: changes needs: changes

View File

@ -175,7 +175,7 @@ testcommon: | build deps
testwaku2: | build deps librln testwaku2: | build deps librln
echo -e $(BUILD_MSG) "build/$@" && \ 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 wakunode2: | build deps librln
echo -e $(BUILD_MSG) "build/$@" && \ echo -e $(BUILD_MSG) "build/$@" && \

View File

@ -19,9 +19,12 @@ import
./v2/waku_archive/test_retention_policy, ./v2/waku_archive/test_retention_policy,
./v2/waku_archive/test_waku_archive ./v2/waku_archive/test_waku_archive
# TODO: add the postgres test when we can mock the database. const os* {.strdefine.} = ""
# The postgres tests now need a running postgresql database running locally. when os == "Linux":
# ./v2/waku_archive/test_driver_postgres, # 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 # Waku store test suite
import import

View File

@ -1,6 +1,5 @@
version: "3.8" version: "3.8"
services: services:
db: db:
image: postgres:9.6-alpine image: postgres:9.6-alpine