---

.script-build:
  stage: build
  needs: ["lint"]
  extends:
    - .rules-branch-and-MR-manual
  script:
    - which go && go version
    - which gcc && gcc --version
    - which qmake && qmake --version
    - git rev-parse --short=10 HEAD
    - make build
    - git diff && git diff-index --quiet HEAD
    - make vault-editor
    - make bridge-rollout
  artifacts:
    expire_in: 1 day
    when: always
    name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
    paths:
      - bridge_*.tgz
      - vault-editor
      - bridge-rollout
build-linux:
  extends:
    - .script-build
    - .env-linux-build

build-linux-qa:
  extends:
    - build-linux
    - .rules-branch-manual-MR-and-devel-always
  variables:
    BUILD_TAGS: "build_qa"

build-darwin:
  extends:
    - .script-build
    - .env-darwin

build-darwin-qa:
  extends:
    - build-darwin
  variables:
    BUILD_TAGS: "build_qa"

build-windows:
  extends:
    - .script-build
    - .env-windows

build-windows-qa:
  extends:
    - build-windows
  variables:
    BUILD_TAGS: "build_qa"

trigger-qa-installer:
  stage: build
  needs: ["lint"]
  extends:
    - .rules-br-tag-always-branch-and-MR-manual
  variables:
    APP: bridge
    WORKFLOW: build-all
    SRC_TAG: $CI_COMMIT_BRANCH
    TAG: $CI_COMMIT_TAG
    SRC_HASH: $CI_COMMIT_SHA
  trigger:
    project: "jcuth/bridge-release"
    branch: master
