Commit f6830be9 authored by Anthony Jacob's avatar Anthony Jacob
Browse files

add test in pipeline

parent bad58e35
Loading
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
@@ -2,9 +2,32 @@
# predefined variables https://docs.gitlab.com/ee/ci/variables/predefined_variables.html

stages:
  - test
  - publish
  - deploy

test-e2e:
  stage: test
  image: node:22
  services:
    - name: postgres:16
      alias: postgres
  variables:
    DB_HOST: postgres
    DB_PORT: "5432"
    DB_USER: postgres
    DB_PASS: postgres
    DB_NAME: trading
    POSTGRES_DB: trading
    POSTGRES_USER: postgres
    POSTGRES_PASSWORD: postgres
    JWT_SECRET: ci-jwt-secret
  script:
    - npm ci
    - npm run test:e2e -- --runInBand
  rules:
    - if: $CI_COMMIT_BRANCH == "main"

publish:
  stage: publish
  image: docker:cli
@@ -48,7 +71,7 @@ deploy-demo:
    - ssh-keyscan -p $SSH_PORT -H $SSH_HOST  > ~/.ssh/known_hosts
    - cat ~/.ssh/known_hosts
  script:
    - ssh $SSH_USER@$SSH_HOST -p $SSH_PORT "docker service update --force --image $DOCKER_IMAGE_NAME stack_trading_bot"
    - ssh $SSH_USER@$SSH_HOST -p $SSH_PORT "docker service update --force --image $DOCKER_IMAGE_NAME stack_tradingbot_api"
  after_script:
    - rm -rf ~/.ssh
  rules: