.gitlab-ci.yml 4.87 KB
Newer Older
1
variables:
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
2 3
  CONTAINER_TEST_IMAGE: psono-docker-local.jfrog.io/psono/psono-client:$CI_BUILD_REF_NAME
  CONTAINER_RELEASE_IMAGE: psono-docker-local.jfrog.io/psono/psono-client:latest
4 5 6 7 8 9 10 11

stages:
  - test
  - build
  - release
  - deploy

unittests:
chickahoona's avatar
chickahoona committed
12 13
  except:
    - schedules
14
  stage: test
15
  image: ubuntu:16.04
16 17
  script:
    - sh ./var/build-ubuntu.sh
18 19 20 21 22
    - apt-get install -y --no-install-recommends xvfb x11vnc fluxbox xterm
    - curl -fsSL https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
    - echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
    - apt-get update
    - apt-get install -y google-chrome-stable
23
    - karma start ./unittests/karma-chrome-headless.conf.js
24 25

linter:
chickahoona's avatar
chickahoona committed
26 27
  except:
    - schedules
28 29 30 31
  stage: test
  image: ubuntu:16.04
  script:
    - sh ./var/build-ubuntu.sh
32
    - cat ./build/firefox/manifest.json
chickahoona's avatar
chickahoona committed
33
    - addons-linter --help
34
    - addons-linter ./build/firefox
35 36 37


docker-image:
chickahoona's avatar
chickahoona committed
38 39
  except:
    - schedules
40 41 42
  stage: build
  image: ubuntu:16.04
  services:
chickahoona's avatar
chickahoona committed
43
    - docker:dind
44 45 46
  variables:
    DOCKER_HOST: 'tcp://docker:2375'
  script:
47
    - sh ./var/build-ubuntu.sh
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
48
    - set -x && curl -fSL "https://download.docker.com/linux/static/stable/x86_64/docker-17.12.0-ce.tgz" -o docker.tgz && echo "692e1c72937f6214b1038def84463018d8e320c8eaf8530546c84c2f8f9c767d *docker.tgz" | sha256sum -c - && tar -xzvf docker.tgz && mv docker/* /usr/local/bin/
chickahoona's avatar
chickahoona committed
49
    - docker info
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
50 51 52
    - echo $CI_BUILD_TOKEN | docker login --username=gitlab-ci-token --password-stdin registry.gitlab.com
    - echo $artifactory_credentials | docker login --username=gitlab --password-stdin psono-docker.jfrog.io
    - echo $artifactory_credentials | docker login --username=gitlab --password-stdin psono-docker-local.jfrog.io
chickahoona's avatar
chickahoona committed
53 54
    - docker build -t $CONTAINER_TEST_IMAGE .
    - docker push $CONTAINER_TEST_IMAGE
55 56

firefox-extension:
chickahoona's avatar
chickahoona committed
57 58
  except:
    - schedules
59
  stage: build
60
  image: ubuntu:16.04
61
  script:
62 63
    - pwd
    - ls -la
chickahoona's avatar
chickahoona committed
64
    - sh ./var/build-ubuntu.sh
65 66
    - mv /builds/psono/psono-client/build/firefox ../
    - rm -Rf *
67
    - rm -Rf .* 2> /dev/null || true
68 69 70 71
    - mv ../firefox/* ./
  artifacts:
    name: "firefox_$CI_BUILD_REF_NAME"
    paths:
chickahoona's avatar
chickahoona committed
72
    - ./*
73 74

chrome-extension:
chickahoona's avatar
chickahoona committed
75 76
  except:
    - schedules
77
  stage: build
78
  image: ubuntu:16.04
79
  script:
80 81
    - pwd
    - ls -la
chickahoona's avatar
chickahoona committed
82
    - sh ./var/build-ubuntu.sh
83 84
    - mv /builds/psono/psono-client/build/chrome ../
    - rm -Rf *
85
    - rm -Rf .* 2> /dev/null || true
86 87 88 89
    - mv ../chrome/* ./
  artifacts:
    name: "chrome_$CI_BUILD_REF_NAME"
    paths:
chickahoona's avatar
chickahoona committed
90
    - ./*
91

92
webclient:
chickahoona's avatar
chickahoona committed
93 94
  except:
    - schedules
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
  stage: build
  image: ubuntu:16.04
  script:
    - pwd
    - ls -la
    - sh ./var/build-ubuntu.sh
    - mv /builds/psono/psono-client/build/webclient ../
    - rm -Rf *
    - rm -Rf .* 2> /dev/null || true
    - mv ../webclient/* ./
  artifacts:
    name: "webclient_$CI_BUILD_REF_NAME"
    paths:
    - ./*

110
release-docker:
chickahoona's avatar
chickahoona committed
111 112
  except:
    - schedules
113 114 115
  stage: release
  image: docker:git
  services:
chickahoona's avatar
chickahoona committed
116
    - docker:dind
117
  script:
chickahoona's avatar
chickahoona committed
118
    - docker info
Sascha Pfeiffer's avatar
Sascha Pfeiffer committed
119 120 121
    - echo $CI_BUILD_TOKEN | docker login --username=gitlab-ci-token --password-stdin registry.gitlab.com
    - echo $artifactory_credentials | docker login --username=gitlab --password-stdin psono-docker.jfrog.io
    - echo $artifactory_credentials | docker login --username=gitlab --password-stdin psono-docker-local.jfrog.io
chickahoona's avatar
chickahoona committed
122 123 124
    - docker pull $CONTAINER_TEST_IMAGE
    - docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE
    - docker push $CONTAINER_RELEASE_IMAGE
125
  only:
126
    - /^v[0-9]*\.[0-9]*\.[0-9]*$/
127

128 129 130 131 132 133 134 135 136 137 138 139
deploy-security-scan-image:
  except:
    - schedules
  stage: deploy
  image: docker:git
  services:
    - docker:dind
  script:
    - sh ./var/deploy_security_scan_image.sh


deploy:
chickahoona's avatar
chickahoona committed
140 141
  except:
    - schedules
142
  stage: deploy
143 144
  image: docker:git
  services:
chickahoona's avatar
chickahoona committed
145
    - docker:dind
146
  script:
147
    - sh ./var/deploy.sh
chickahoona's avatar
chickahoona committed
148 149 150
  environment:
    name: production
    url: https://psono.pw
151
  only:
152
    - /^v[0-9]*\.[0-9]*\.[0-9]*$/
153

154 155

deploy-chrome:
chickahoona's avatar
chickahoona committed
156 157
  except:
    - schedules
158 159 160 161
  stage: deploy
  image: ubuntu:16.04
  script:
    - sh ./var/build-ubuntu.sh
chickahoona's avatar
chickahoona committed
162
    - sh ./var/package-chrome-extension.sh
163
    - sh ./var/deploy-chrome-extension.sh
chickahoona's avatar
chickahoona committed
164 165 166
  environment:
    name: chrome-webstore
    url: https://chrome.google.com/webstore/detail/psonopw/eljmjmgjkbmpmfljlmklcfineebidmlo
167
  only:
168
    - /^v[0-9]*\.[0-9]*\.[0-9]*$/
169

170
deploy-firefox:
chickahoona's avatar
chickahoona committed
171 172
  except:
    - schedules
173 174 175 176
  stage: deploy
  image: ubuntu:16.04
  script:
    - sh ./var/build-ubuntu.sh
chickahoona's avatar
chickahoona committed
177
    - sh ./var/package-firefox-extension.sh
178 179 180 181 182 183
    - sh ./var/deploy-firefox-extension.sh
  environment:
    name: firefox-webstore
    url: https://addons.mozilla.org/de/firefox/addon/psono-pw-password-manager/
  only:
    - /^v[0-9]*\.[0-9]*\.[0-9]*$/
chickahoona's avatar
chickahoona committed
184 185 186 187 188 189 190 191 192 193 194

scheduled-linter:
  only:
    - schedules
  stage: test
  image: ubuntu:16.04
  script:
    - sh ./var/build-ubuntu.sh
    - cat ./build/firefox/manifest.json
    - addons-linter --help
    - addons-linter ./build/firefox