.gitlab-ci.yml 2.44 KB
Newer Older
1
stages:
Millicent Billette's avatar
Millicent Billette committed
2 3 4
  - build
  - alt_build
  - publish
5

Millicent Billette's avatar
Millicent Billette committed
6
fast-build:
7
  stage: build
Millicent Billette's avatar
Millicent Billette committed
8
  image: $CI_REGISTRY_IMAGE
Millicent Billette's avatar
Millicent Billette committed
9
  before_script:
Millicent Billette's avatar
Millicent Billette committed
10 11 12
    - mv /customCache/node_modules ./
    - cp -rf /customCache/www ./
    - cp -rf /customCache/hooks ./
Millicent Billette's avatar
Millicent Billette committed
13
  script:
Benoit Lavenier's avatar
Benoit Lavenier committed
14
    - node ./node_modules/gulp/bin/gulp webBuild
Millicent Billette's avatar
Millicent Billette committed
15
  after_script:
16 17
    - ls -la dist/web/
    - du -csh dist/web/
Millicent Billette's avatar
Millicent Billette committed
18
  artifacts:
Millicent Billette's avatar
Millicent Billette committed
19
    untracked: true
Millicent Billette's avatar
Millicent Billette committed
20
    paths:
21
      - dist/web
Millicent Billette's avatar
Millicent Billette committed
22 23 24
    expire_in: 60 minutes
  only:
    - master
Millicent Billette's avatar
Millicent Billette committed
25
    - tags
Millicent Billette's avatar
Millicent Billette committed
26 27
failsafe-build:
  stage: alt_build
Millicent Billette's avatar
Millicent Billette committed
28
  when: on_failure
Benoit Lavenier's avatar
Benoit Lavenier committed
29
  image: node:10
30
  script:
31 32
    - yarn
    - node ./node_modules/gulp/bin/gulp config --env default
Benoit Lavenier's avatar
Benoit Lavenier committed
33
    - node ./node_modules/gulp/bin/gulp webBuild
34 35 36
  artifacts:
    untracked: true
    paths:
37
      - dist/web
38 39 40
    expire_in: 60 minutes
  only:
    - master
Millicent Billette's avatar
Millicent Billette committed
41
    - tags
Millicent Billette's avatar
Millicent Billette committed
42 43 44 45 46 47 48 49 50 51
docker-for-fast-build:
  stage: alt_build
  when: on_failure
  allow_failure: true
  tags:
    - doppler-docker
  image: docker:latest
  services:
    - docker:dind
  script:
Benoit Lavenier's avatar
Benoit Lavenier committed
52
    - echo 'FROM node:10' > Dockerfile
Millicent Billette's avatar
Millicent Billette committed
53
    - echo 'WORKDIR /customCache' >> Dockerfile
Millicent Billette's avatar
Millicent Billette committed
54
    - echo 'COPY ./ ./' >> Dockerfile
Millicent Billette's avatar
Millicent Billette committed
55
    - echo 'RUN du -s `find . -maxdepth 1 | egrep -v "^\.$"`>/before.txt' >> Dockerfile
56
    - echo 'RUN yarn' >> Dockerfile
Millicent Billette's avatar
Millicent Billette committed
57
    - echo 'RUN du -s `find . -maxdepth 1 | egrep -v "^\.$"`>/after.txt' >> Dockerfile
Millicent Billette's avatar
Millicent Billette committed
58
    - echo 'WORKDIR /build' >> Dockerfile
Millicent Billette's avatar
Millicent Billette committed
59
    - echo "RUN diff /before.txt /after.txt || true" >> Dockerfile
Millicent Billette's avatar
Millicent Billette committed
60 61 62 63 64
    - docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" $CI_REGISTRY
    - docker build --pull -t "$CI_REGISTRY_IMAGE" .
    - docker push "$CI_REGISTRY_IMAGE"


65 66
pages:
  stage: publish
Benoit Lavenier's avatar
Benoit Lavenier committed
67
  image: node:10
Millicent Billette's avatar
Millicent Billette committed
68 69
  variables:
    GIT_STRATEGY: none
70
  script:
Millicent Billette's avatar
Millicent Billette committed
71
    - ls -la public || true
72
    - mv dist/web/www public
73 74 75 76 77 78
  artifacts:
    untracked: true
    paths:
      - public
  only:
    - master
Millicent Billette's avatar
Millicent Billette committed
79 80 81 82 83 84 85 86 87 88 89
mirror:
  stage: publish
  image: liaohuqiu/rsync
  before_script:
    - eval $(ssh-agent -s)
    - ssh-add <(echo "$SSH_PRIVATE_KEY")
    - mkdir -p ~/.ssh
    - >-
      [[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" >
      ~/.ssh/config
  script:
90
    - mv dist/web/www public
Millicent Billette's avatar
Millicent Billette committed
91
    - rsync -az -e ssh ./public/ gammanu@1000i100.fr:~/g1.money/dev-cesium
92 93
  after_script:
    - ssh gammanu@1000i100.fr "~/g1.money/update-cesium.sh"
Millicent Billette's avatar
Millicent Billette committed
94 95 96
  only:
    - master

97

98 99
release-web:
  stage: publish
Benoit Lavenier's avatar
Benoit Lavenier committed
100
  image: node:10
Millicent Billette's avatar
Millicent Billette committed
101 102
  variables:
    GIT_STRATEGY: none
103
  script:
Millicent Billette's avatar
Millicent Billette committed
104
    - ls -la www || true
105
    - mv dist/web/www www
106 107 108 109 110 111 112
  artifacts:
    untracked: true
    paths:
      - www
  only:
    - tags