# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/node/tags/
image: golang:1.24

default:
  before_script:
    - go clean -modcache
    - git config --global url."https://$USERNAME:$MULTIDB_ACCESS_TOKEN@gitlab.com/quantex-exchange".insteadOf "https://gitlab.com/quantex-exchange"
    - export GOPRIVATE="quantex.com.ar/multidb"
    - go get quantex.com.ar/multidb@v1.2.2
    - make gogenerate
    - make swag
    - go mod vendor
  artifacts:
    when: always
    paths:
      - qfixdpl.gz

stages:
  - lint
  - build

regular:
  stage: build
  needs: []
  except:
    - master
    - develop
    - demo
    - open-demo
  script:
    - go clean -cache
    - make gogenerate
    - make swag
    - make test
    - make check
    - make build
    - mv build/out/distribution/qfixdpl.gz .

develop:
  stage: build
  needs: []
  only:
    - develop
  script:
    - make gogenerate
    - make swag
    - make test
    - make only-build
    - mv build/out/distribution/qfixdpl.gz .
  environment:
    name: dev
    url: https://dev.quantex.com.ar

master:
  stage: build
  needs: []
  only:
    - master
  script:
    - go clean -cache
    - make gogenerate
    - make swag
    - make test
    - make build
    - mv build/out/distribution/qfixdpl.gz .
  environment:
    name: prod
    url: https://app.quantex.com.ar

demo:
  stage: build
  needs: []
  only:
    - demo
  script:
    - make test
    - make only-build
    - apt-get update
    - apt-get install sshpass
    - mv build/out/distribution/qfixdpl.gz .
  environment:
    name: demo
    url: https://demo.quantex.com.ar

open-demo:
  stage: build
  needs: []
  only:
    - open-demo
  script:
    - make test
    - make only-build
    - apt-get update
    - apt-get install sshpass
    - mv build/out/distribution/qfixdpl.gz .
  environment:
    name: open-demo
    url: https://open-demo.quantex.com.ar
