Skip to content
Snippets Groups Projects
.gitlab-ci.yml 5.31 KiB
################################################################################
## Copyright © 2018 Privategrity Corporation                                   #
##                                                                             #
## All rights reserved.                                                        #
################################################################################

# This drives all the integration tests. When you create a new test, add it as a
# new stage to this file. The stage should have a very clear report and may need
# to run a couple commands to publish.

cache:
  untracked: true
  key: "$CI_BUILD_REF_NAME"
#  paths:
#    - vendor/

variables:
  REPO_DIR: gitlab.com/elixxir
  REPO_NAME: server
  DOCKER_IMAGE: bmastc/golang-glide:latest
  # See https://docs.gitlab.com/ee/api/jobs.html#download-a-single-artifact-file-from-specific-tag-or-branch
  REPOS_API: https://gitlab.com/api/v4/projects/elixxir%2F
  SERVER_URL: ${REPOS_API}server/jobs/artifacts/$SERVER_ID/raw/release/server.linux64?job=build
  CLIENT_URL: ${REPOS_API}client/jobs/artifacts/$CLIENT_ID/raw/release/client.linux64?job=build
  REGISTRATION_URL: ${REPOS_API}registration/jobs/artifacts/$REGISTRATION_ID/raw/release/registration.linux64?job=build
  UDB_URL: ${REPOS_API}user-discovery-bot/jobs/artifacts/$UDB_ID/raw/release/udb.linux64?job=build
  GATEWAY_URL: ${REPOS_API}gateway/jobs/artifacts/$GATEWAY_ID/raw/release/gateway.linux64?job=build
  DEFAULTBRANCH: "release"

before_script:
  ##
  ## Go Setup
  ##
  ##  - go version || echo "Go executable not found."
  ##  - mkdir -p $GOPATH/src/$REPO_DIR
  ##  - ln -s $CI_PROJECT_DIR $GOPATH/src/$REPO_DIR/$REPO_NAME
  ##  - cd $GOPATH/src/$REPO_DIR/$REPO_NAME
  - echo $CI_BUILD_REF
  - echo $CI_PROJECT_DIR
  - echo $CI_BUILD_REF_NAME

stages:
  - installbinaries
  - tests
  - benchmark

installbinaries:
  stage: installbinaries
  image: $DOCKER_IMAGE
  script:
    - git clean -ffdx
    - mkdir -p ~/.elixxir
    - mkdir -p bin
    - cd bin
    - "DOWNLOADS=\"$SERVER_URL $CLIENT_URL $REGISTRATION_URL $UDB_URL $GATEWAY_URL\""
    - >
      if [ "$CI_BUILD_REF_NAME" == "master" ]; then
        DOWNLOADS=$(echo $DOWNLOADS | sed "s/artifacts\/$DEFAULTBRANCH\/raw/artifacts\/master\/raw/g")
      fi
    - >
      for D in $DOWNLOADS; do
        echo $D
        curl -f -O -s -L -H "PRIVATE-TOKEN: $PATKEY" $D
      done
    - ls -lha
    - mv server.linux64?job=build server
    - mv client.linux64?job=build client
    - mv udb.linux64?job=build udb
    - mv registration.linux64?job=build permissioning
    - mv gateway.linux64?job=build gateway