GitLab steht Mittwoch, den 08. Juli, zwischen 09:00 und 13:00 Uhr aufgrund von Wartungsarbeiten nicht zur Verfügung.

.gitlab-ci.yml 5.06 KB
Newer Older
Tom Käsler's avatar
Tom Käsler committed
1
stages:
2
  - install
3
  - test
4
  - build
5
  - assets
Tom Käsler's avatar
Tom Käsler committed
6
  - deploy
7 8 9
  - build-beta
  - assets-beta
  - deploy-beta
Tom Käsler's avatar
Tom Käsler committed
10

Tom Käsler's avatar
Tom Käsler committed
11 12 13 14
# Cache modules in between jobs
cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
15
    - node_modules/
Tom Käsler's avatar
Tom Käsler committed
16

Tom Käsler's avatar
Tom Käsler committed
17
install_node_modules:
18
  stage: install
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
19
  except:
20
    - /^i18n-change.*/ix
21 22 23
  tags:
    - nodejs
  script:
24
    - npm install
Tom Käsler's avatar
Tom Käsler committed
25

26
ts_lint:
Tom Käsler's avatar
Tom Käsler committed
27
  stage: test
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
28
  except:
29
    - /^i18n-change.*/ix
30 31 32
  tags:
    - nodejs
  script:
33
    - npm install
Tom Käsler's avatar
Tom Käsler committed
34
    - node_modules/tslint/bin/tslint -c tslint.json -p tsconfig.json
35

36
npm_test:
37 38 39
  stage: test
  tags:
    - nodejs
40
    - angular
41
  script:
42 43 44
    - curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
    - echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
    - apt-get -y update
Tom Käsler's avatar
Tom Käsler committed
45
    - apt-get -y install --allow-unauthenticated google-chrome-stable
46
    - npm install
47
    - npm test
48

Tom Käsler's avatar
Tom Käsler committed
49 50 51 52 53 54
build:
  stage: build
  only:
    - master
  tags:
    - nodejs
55
    - angular
56 57
  before_script:
    - sed -ri "s|\"VERSION\"|\"$CI_COMMIT_SHA\"|" src/environments/environment.thm.staging.ts
Tom Käsler's avatar
Tom Käsler committed
58
  script:
59
    - npm install
60
    - npm install typescript@3.5.3
61
    - npm run build:STAGING_THM
62 63 64 65 66
  artifacts:
    paths:
      - dist

generate_assets:
67 68 69
  stage: assets
  only:
    - master
70 71 72 73 74 75 76
  tags:
    - nodejs
  dependencies:
    - build
  script:
    - apt-get -y update
    - apt-get -y install --allow-unauthenticated gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
77
    - npm i
78
    - npm install -g angular-http-server
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
79
    - cd dist
80
    - angular-http-server --path browser/ --silent -p 4711 &
81 82 83
    - cd browser/assets/jobs
    - node GenerateMetaNodes.js --command=generateLinkImages --baseUrl=https://staging.arsnova.click
    - node GenerateMetaNodes.js --command=generateManifest --baseUrl=https://staging.arsnova.click
84 85 86 87
    - node --experimental-modules GenerateImages.mjs --command=generateLogoImages
    - node --experimental-modules GenerateImages.mjs --command=generateFrontendPreview --host=http://localhost:4711 --root=true
    - cd ../../../..
    - npm run compress
Tom Käsler's avatar
Tom Käsler committed
88 89
  artifacts:
    paths:
Tom Käsler's avatar
Tom Käsler committed
90
      - dist
Tom Käsler's avatar
Tom Käsler committed
91 92 93 94 95 96

deploy:
  stage: deploy
  only:
    - master
  tags:
Tom Käsler's avatar
Tom Käsler committed
97
    - rsync
Tom Käsler's avatar
Tom Käsler committed
98
  dependencies:
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
99
    - generate_assets
100
  environment:
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
101
    name: Staging
Tom Käsler's avatar
Tom Käsler committed
102
  script:
Tom Käsler's avatar
Tom Käsler committed
103
    - chmod -R a+rX,ug+w .
Tom Käsler's avatar
Tom Käsler committed
104
    - eval $(ssh-agent -s)
Tom Käsler's avatar
Tom Käsler committed
105 106
    - mkdir ~/.ssh
    - ssh-keyscan "$STAGING_FRONTEND_URL" >> ~/.ssh/known_hosts
Tom Käsler's avatar
Tom Käsler committed
107
    - ssh-add <(echo "$STAGING_SSH_PRIVATE_KEY")
108
    #- rm dist/*.map
Tom Käsler's avatar
Tom Käsler committed
109
    - rsync -rltgoDqv --delete -e "ssh" dist/* "$STAGING_FRONTEND_SCP_URL"
110
    - ssh $STAGING_SSH 'touch /home/arsnova/arsnova.click-v2/frontend/deploy.touch'
111

112 113
build-beta:
  stage: build-beta
114
  only:
115
    - beta
116 117 118
  tags:
    - nodejs
    - angular
119 120
  before_script:
    - sed -ri "s|\"VERSION\"|\"$CI_COMMIT_SHA\"|" src/environments/environment.thm.beta.ts
121 122
  script:
    - npm install
123
    - npm install typescript@3.5.3
124
    - npm run build:BETA_THM
125 126
  artifacts:
    paths:
127
      - dist
128

129 130
generate_assets-beta:
  stage: assets-beta
131
  only:
132
    - beta
133 134 135
  tags:
    - nodejs
  dependencies:
136
    - build-beta
137 138 139
  script:
    - apt-get -y update
    - apt-get -y install --allow-unauthenticated gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
140
    - npm i
141
    - npm install -g angular-http-server
142
    - cd dist
143 144 145 146
    - angular-http-server --path browser/ --silent -p 4711 &
    - cd browser/assets/jobs
    - node GenerateMetaNodes.js --command=generateLinkImages --baseUrl=https://beta.arsnova.click
    - node GenerateMetaNodes.js --command=generateManifest --baseUrl=https://beta.arsnova.click
147 148 149 150
    - node --experimental-modules GenerateImages.mjs --command=generateLogoImages
    - node --experimental-modules GenerateImages.mjs --command=generateFrontendPreview --host=http://localhost:4711 --root=true
    - cd ../../../..
    - npm run compress
151 152
  artifacts:
    paths:
153
      - dist
154

155 156
deploy-beta:
  stage: deploy-beta
157
  only:
158
    - beta
159 160 161
  tags:
    - rsync
  dependencies:
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
162
    - generate_assets-beta
163
  environment:
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
164
    name: Beta
165 166 167 168 169 170
  script:
    - chmod -R a+rX,ug+w .
    - eval $(ssh-agent -s)
    - mkdir ~/.ssh
    - ssh-keyscan "$STAGING_FRONTEND_URL" >> ~/.ssh/known_hosts
    - ssh-add <(echo "$STAGING_SSH_PRIVATE_KEY")
171
    #- rm dist/*.map
172
    - rsync -rltgoDqv --delete -e "ssh" dist/* "$BETA_FRONTEND_SCP_URL"
173
    - ssh $STAGING_SSH 'touch /home/arsnova/arsnova.click-v2-beta/frontend/deploy.touch'