En raison du déménagement des baies serveurs, les services gitlab.irstea.fr et mattermost.irstea.fr seront interrompus le samedi 2 octobre 2021 au matin. Ils devraient revenir à la normale dans la journée.

.gitlab-ci.yml 1.89 KB
Newer Older
1
2
3
include:
  - local: 'prezbuilder-ci.yml'

4
default:
5
  tags: [docker]
6
7
8
9
  retry: 2
  interruptible: true

stages:
10
  - build
11
  - test
12
13
  - deploy

14
15
node_modules:
  stage: build
16
  image: node:12-buster
Guillaume Perréal's avatar
Guillaume Perréal committed
17
18
  variables:
    NPM_CONFIG_CACHE: "$CI_PROJECT_DIR/.npm"
19
  script:
20
    - npm install
Guillaume Perréal's avatar
Guillaume Perréal committed
21
  cache:
22
    key: "$CI_COMMIT_REF_SLUG-$CI_JOB_NAME"
Guillaume Perréal's avatar
Guillaume Perréal committed
23
24
    paths:
      - "$NPM_CONFIG_CACHE"
25
26
27
28
  artifacts:
    expire_in: 1 day
    paths:
      - node_modules/
29

30
docker-image:
31
32
33
  stage: build
  tags: [dind]
  variables:
34
    IMAGE: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME"
35
36
  before_script:
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
37
  script:
38
39
    - docker pull "$IMAGE" || exit 0
    - docker build --cache-from "node:buster-12,$IMAGE" --tag "$IMAGE" .
40
41
42
43
    - docker run --rm "$IMAGE" build src public
    - "[ -e public/index.html ]"
    - rm -rf public/*
    - bin/prezbuilder-docker build src public
44
45
    - docker push "$IMAGE"

46
lint:
47
  stage: test
48
  image: node:12-buster
49
50
51
52
53
54
55
  needs:
    - node_modules
  script:
    - npm run lint

run-from-sources:
  stage: test
56
  image: node:12-buster
57
58
  needs:
    - node_modules
59
60
  before_script:
    - apt-get update -yq && apt-get install -yq pandoc wkhtmltopdf
61
  script:
62
    - bin/prezbuilder build src public
63
    - "[ -e public/index.html ]"
64

65
run-from-npm:
66
  stage: test
67
  image: node:12-buster
68
  needs: []
69
70
  variables:
    GIT_STRATEGY: none
71
  before_script:
72
73
74
75
76
    - apt-get update -yq && apt-get install -yq pandoc wkhtmltopdf
    - set -x
    - mkdir -p $HOME/prezbuilder
    - cd $HOME/prezbuilder
    - npm install "git+${CI_REPOSITORY_URL}#${CI_COMMIT_REF_NAME}"
77
  script:
78
79
    - node_modules/.bin/prezbuilder build $CI_PROJECT_DIR/src $CI_PROJECT_DIR/public
    - "[ -e $CI_PROJECT_DIR/public/index.html ]"
80

81
pages:
82
83
84
  extends: .prezbuilder
  variables:
    PREZBUILDER_IMAGE: "$CI_REGISTRY_IMAGE"
85
    PREZBUILDER_TAG: "$CI_COMMIT_REF_NAME"
Guillaume Perréal's avatar
Guillaume Perréal committed
86
  rules:
87
    - if: $CI_COMMIT_TAG