From 260b597961ffe3dea4e96753a5bd69559702a8ff Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Thu, 5 May 2022 21:29:22 +0100 Subject: [PATCH] add test job --- .github/workflows/test.common-server.yaml | 20 ++++++++++++++++++++ CommonServer/test-setup.sh | 7 +++++++ package.json | 1 + 3 files changed, 28 insertions(+) create mode 100644 .github/workflows/test.common-server.yaml create mode 100644 CommonServer/test-setup.sh diff --git a/.github/workflows/test.common-server.yaml b/.github/workflows/test.common-server.yaml new file mode 100644 index 0000000000..5d473ac35e --- /dev/null +++ b/.github/workflows/test.common-server.yaml @@ -0,0 +1,20 @@ +name: Common Test + +on: + push: + branches-ignore: + - 'hotfix-*' # excludes hotfix branches + - 'release' + - 'staging-release' + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + check-latest: true + - run: cd Common && npm install + - run: cd CommonServer && bash test-setup.sh + - run: cd CommonServer && npm install && npm run test \ No newline at end of file diff --git a/CommonServer/test-setup.sh b/CommonServer/test-setup.sh new file mode 100644 index 0000000000..366c6ccb4d --- /dev/null +++ b/CommonServer/test-setup.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# Run database in docker-compose + +cd .. +# Run Postgres +npm run-script start-enterprise-ci postgres \ No newline at end of file diff --git a/package.json b/package.json index 3089ef8f75..42fed97adf 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "dev": "npm run start-enterprise-dev $npm_config_services", "saas-dev": "export IS_SAAS_SERVICE=true && npm run dev $npm_config_services", "start-enterprise-dev": "export DOCKER_CLIENT_TIMEOUT=1000 && export COMPOSE_HTTP_TIMEOUT=1000 && docker-compose -f docker-compose.dev.yml up -d $npm_config_services", + "start-enterprise-ci": "export DOCKER_CLIENT_TIMEOUT=1000 && export COMPOSE_HTTP_TIMEOUT=1000 && docker-compose -f docker-compose.ci.yml up -d $npm_config_services", "stop-dev": "docker-compose -f docker-compose.dev.yml down --remove-orphans", "staging-test": "cd tests && npm run-script staging-test", "remove-all-containers": "docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q) || echo 'No running containers'",