.gitlab-ci.yml 3.77 KB
Newer Older
1

2 3
image: ubuntu:16.04

Emeric Verschuur's avatar
Emeric Verschuur committed
4
variables:
5
  GLOBAL_TEST_VAR: "scope: global"
Emeric Verschuur's avatar
Emeric Verschuur committed
6 7 8 9

after_script:
  - echo "job ${CI_JOB_NAME} end"

10
job-minimal:
11
  stage: build
Emeric Verschuur's avatar
Emeric Verschuur committed
12 13
  tags:
    - docker
14
  script:
Emeric Verschuur's avatar
Emeric Verschuur committed
15
    - echo "Hello world"
16

Emeric Verschuur's avatar
Emeric Verschuur committed
17
job-with-before-after-script:
18
  stage: build
Emeric Verschuur's avatar
Emeric Verschuur committed
19 20
  tags:
    - docker
Emeric Verschuur's avatar
Emeric Verschuur committed
21 22
  before_script:
    - echo "executed before"
23
  script:
Emeric Verschuur's avatar
Emeric Verschuur committed
24 25 26 27 28 29
    - echo "script"
      "on several"
    - echo "lines"
    - cat <<< $(echo 'hi!')
  after_script:
    - echo "executed after"
30

Emeric Verschuur's avatar
Emeric Verschuur committed
31
job-advanced:
32
  image: ubuntu:16.04
33
  stage: build
Emeric Verschuur's avatar
Emeric Verschuur committed
34 35
  tags:
    - docker
Emeric Verschuur's avatar
Emeric Verschuur committed
36
  variables:
37
    JOB_TEST_VAR: "${CI_JOB_NAME} - ${GLOBAL_TEST_VAR}"
38
  script:
39
    - ci-scripts/run-job-script.sh
40

41
job-test-services-mysql:
42 43 44 45
  stage: build
  variables:
    MYSQL_DATABASE: test
    MYSQL_ROOT_PASSWORD: password
46
  image: mysql
47 48
  services:
    - mysql
49
  tags:
Emeric Verschuur's avatar
Emeric Verschuur committed
50
    - docker
51
  script:
52 53 54 55
    - printf "Waiting for mysql";
      while ! mysql -h mysql -u root -ppassword test -e '' > /dev/null 2>&1 ;
      do printf "."; sleep 1; done;
      printf " done!\n"
56 57 58 59 60 61
    - mysql -h mysql -u root -ppassword test -e 'SHOW VARIABLES LIKE "%version%";'

job-test-services-postgres:
  stage: build
  image: postgres:9.4
  services:
62 63 64 65 66
    - name: postgres:9.4
      alias: db-postgres
      entrypoint: ["docker-entrypoint.sh"]
      command: ["postgres"]
  tags:
Emeric Verschuur's avatar
Emeric Verschuur committed
67
    - docker
68
  script:
69 70 71 72
    - printf "Waiting for postgres";
      while ! psql -h db-postgres -U postgres -c '' > /dev/null 2>&1 ;
      do printf "."; sleep 1; done;
      printf " done!\n"
73
    - psql -h db-postgres -U postgres -c 'select version();'
74 75 76 77 78 79 80 81 82

##################################################
#             ### PACKAGE BUILD ###              #
##################################################

.build-package-template: &build-package-template
  image: registry.gitlab.com/ercom/docker-images/fpm:1.10.0-ubuntu-16.04
  stage: build
  variables:
83
    CITBX_JOB_FILE_NAME: build-package.sh
84 85 86 87 88 89 90 91 92
  tags:
    - docker
  script:
    - ci-scripts/run-job-script.sh

.package-channel-dev: &package-channel-dev
  except:
    - tags
    - master
93
    - experimental
94 95 96 97 98

.package-channel-rel: &package-channel-rel
  only:
    - tags
    - master
99
    - experimental
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119

.build-package-dev: &build-package-dev
  <<: *build-package-template
  <<: *package-channel-dev
  artifacts:
    paths:
    - artifacts/
    expire_in: 7d

.build-package-rel: &build-package-rel
  <<: *build-package-template
  <<: *package-channel-rel
  artifacts:
    paths:
    - artifacts/

build-package-dev-deb: *build-package-dev
build-package-dev-rpm: *build-package-dev
build-package-rel-deb: *build-package-rel
build-package-rel-rpm: *build-package-rel
120 121 122 123 124 125 126 127

##################################################
#          ### PACKAGE TESTSUITES ###            #
##################################################

.test-package-template: &test-package-template
  stage: test
  variables:
128
    CITBX_JOB_FILE_NAME: test-package.sh
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
  tags: ["docker"]
  script: ["ci-scripts/run-job-script.sh"]

test-package-deb-dev-ubuntu-18.04:
  image: ubuntu:16.04
  dependencies: ["build-package-dev-deb"]
  <<: *test-package-template
  <<: *package-channel-dev
test-package-deb-dev-ubuntu-16.04:
  image: ubuntu:16.04
  dependencies: ["build-package-dev-deb"]
  <<: *test-package-template
  <<: *package-channel-dev
test-package-rpm-dev-fedora-27:
  image: fedora:27
  dependencies: ["build-package-dev-rpm"]
  <<: *test-package-template
  <<: *package-channel-dev

test-package-deb-rel-ubuntu-18.04:
  image: ubuntu:16.04
  dependencies: ["build-package-rel-deb"]
  <<: *test-package-template
  <<: *package-channel-rel
test-package-deb-rel-ubuntu-14.04:
  image: ubuntu:16.04
  dependencies: ["build-package-rel-deb"]
  <<: *test-package-template
  <<: *package-channel-rel
test-package-rpm-rel-fedora-27:
  image: fedora:27
  dependencies: ["build-package-rel-rpm"]
  <<: *test-package-template
  <<: *package-channel-rel