.gitlab-ci.yml 5.05 KB
Newer Older
Henrik Tramberend's avatar
Henrik Tramberend committed
1
stages:
2
  - ci-img
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
3
  - build
4
  - test
5
  - deploy
Henrik Tramberend's avatar
Henrik Tramberend committed
6

7
ci-img:
8 9
  tags:
    - docker
10 11 12 13
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  stage: ci-img
14
  script:
15 16 17 18 19 20 21 22
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
    - /kaniko/executor --context=$CI_PROJECT_DIR --dockerfile=$CI_PROJECT_DIR/Dockerfile --target=base --verbosity=warn --destination=$CI_REGISTRY_IMAGE/ci:base
  rules:
    - if: "$CI_MERGE_REQUEST_IID == null"
      changes:
        - Dockerfile
        - .gitlab-ci.yml
      when: always
23

Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
24
build:linux:
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
25
  stage: build
26
  tags:
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
27 28
    - docker
  image:
29
    name: $CI_REGISTRY_IMAGE/ci:base
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
30
    entrypoint: [""]
Kristof Korwisi's avatar
Kristof Korwisi committed
31
  script:
32 33 34
    - mkdir -p /cache/decker
    - STACK_ROOT=/cache/decker make clean-build
    - cp $(STACK_ROOT=/cache/decker stack path | grep "local-install-root" | awk '{printf "%s/bin/decker",$2}') decker
35 36 37
  artifacts:
    paths:
      - decker
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
38 39 40 41
  cache:
    key: stack_work
    paths:
      - .stack-work
42
  interruptible: true
43

Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
44
build:mac:
45 46
  tags:
    - mac
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
47
  stage: build
48
  script:
49
    - brew upgrade node
50
    - git rev-parse --short HEAD
51
    - make clean-build
52
    - cp $(stack path | grep "local-install-root" | awk '{printf "%s/bin/decker",$2}') decker
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
53 54
  cache:
    key: ${CI_JOB_NAME}
55
    paths:
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
56
      - .stack-work
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
57 58
  artifacts:
    paths:
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
59
      - decker
60 61 62
  when: always
  interruptible: true
  needs: []
Henrik Tramberend's avatar
Henrik Tramberend committed
63

64
build:win:
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
65 66 67 68
  tags:
    - win
  stage: build
  script:
69
    - '&.\bin\build.ps1 standalone -preparepackage'
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
70 71 72 73 74 75 76 77
  artifacts:
    paths:
      - decker.exe
      - version.txt
  cache:
    key: build-win
    paths:
      - .stack-work
78 79 80
  when: always
  interruptible: true
  needs: []
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
81

Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
82
test:linux:
83 84 85 86
  stage: test
  tags:
    - docker
  image:
87
    name: $CI_REGISTRY_IMAGE/ci:base
88 89
    entrypoint: [""]
  script:
90
    - STACK_ROOT=/cache/decker make test
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
91 92 93 94
  cache:
    key: stack_work
    paths:
      - .stack-work
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
95
  needs:
96
    - job: build:linux
97
  interruptible: true
98

99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
test:mac:
  stage: test
  tags:
    - mac
  script:
    - make test
  cache:
    key: stack_work
    paths:
      - .stack-work
  needs:
    - job: build:mac
  interruptible: true

test:win:
  tags:
    - win
  stage: test
  script:
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
118
    - "& stack test -j1"
119 120 121 122 123 124 125 126 127
  cache:
    key: test-win
    paths:
      - .stack-work
  when: always
  needs:
    - job: build:win
  interruptible: true

Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
128 129
deploy:mac:
  stage: deploy
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
130
  image:
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
131 132 133 134 135 136 137
    name: minio/mc:latest
    entrypoint: [""]
  variables:
    GIT_STRATEGY: none
  tags:
    - docker
  script:
138
    - if [ $CI_COMMIT_REF_NAME == "master" ]; then SUFFIX="-nightly"; else SUFFIX="-release"; fi
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
139
    - mc config host add store http://store.hci.informatik.uni-wuerzburg.de:9002 $MINIO_ACCESS $MINIO_SECRET --api S3v4
Armin Bernstetter's avatar
Armin Bernstetter committed
140
    - mc cp ./decker store/decker/decker-mac${SUFFIX}
141 142 143 144 145 146
  needs:
    - job: build:mac
      artifacts: true
  rules:
    - if: '$CI_COMMIT_REF_NAME == "master"'
      when: always
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
147
    - if: '$CI_COMMIT_REF_NAME =~ /^v\d\.\d\.\d-patching$/'
148
      when: always
149 150
  interruptible: true
  resource_group: deploy_mac
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
151

Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
152
deploy:linux:
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
153
  stage: deploy
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
154
  image:
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
155 156 157 158 159 160 161
    name: minio/mc:latest
    entrypoint: [""]
  variables:
    GIT_STRATEGY: none
  tags:
    - docker
  script:
162
    - if [ $CI_COMMIT_REF_NAME == "master" ]; then SUFFIX="-nightly"; else SUFFIX="-release"; fi
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
163
    - mc config host add store http://store.hci.informatik.uni-wuerzburg.de:9002 $MINIO_ACCESS $MINIO_SECRET --api S3v4
Armin Bernstetter's avatar
Armin Bernstetter committed
164
    - mc cp ./decker store/decker/decker-linux${SUFFIX}
165 166 167 168 169 170
  needs:
    - job: build:linux
      artifacts: true
  rules:
    - if: '$CI_COMMIT_REF_NAME == "master"'
      when: always
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
171
    - if: '$CI_COMMIT_REF_NAME =~ /^v\d\.\d\.\d-patching$/'
172
      when: always
173 174
  interruptible: true
  resource_group: deploy_linux
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
175

Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
deploy:docker:
  stage: deploy
  tags:
    - docker
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
    - /kaniko/executor --context=$CI_PROJECT_DIR --dockerfile=$CI_PROJECT_DIR/Dockerfile-prebuilt --verbosity=warn --destination=$CI_REGISTRY_IMAGE:latest
  needs:
    - job: build:linux
      artifacts: true
  rules:
    - if: '$CI_COMMIT_REF_NAME == "master"'
      when: always
    - if: '$CI_COMMIT_REF_NAME =~ /^v\d\.\d\.\d-patching$/'
      when: always
  interruptible: true

Armin Bernstetter's avatar
Armin Bernstetter committed
196
deploy:win:
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
197
  stage: deploy
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
198
  image:
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
199 200 201 202 203 204 205
    name: minio/mc:latest
    entrypoint: [""]
  variables:
    GIT_STRATEGY: none
  tags:
    - docker
  script:
206
    - if [ $CI_COMMIT_REF_NAME == "master" ]; then SUFFIX="-nightly"; else SUFFIX="-release"; fi
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
207
    - mc config host add store http://store.hci.informatik.uni-wuerzburg.de:9002 $MINIO_ACCESS $MINIO_SECRET --api S3v4
Armin Bernstetter's avatar
Armin Bernstetter committed
208 209
    - mc cp ./decker.exe store/decker/decker-win${SUFFIX}.exe
    - mc cp ./version.txt store/decker/version-win${SUFFIX}.txt
210 211 212 213 214 215
  needs:
    - job: build:win
      artifacts: true
  rules:
    - if: '$CI_COMMIT_REF_NAME == "master"'
      when: always
Jan-Philipp Stauffert's avatar
Jan-Philipp Stauffert committed
216
    - if: '$CI_COMMIT_REF_NAME =~ /^v\d\.\d\.\d-patching$/'
217
      when: always
218 219
  interruptible: true
  resource_group: deploy_win