aboutsummaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 27990c1eee9b5810fd5fbffc478b0f4f1495ae59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
stages:
  - test
  - test_brew
  - build_container
  - deploy

build-meson:
  image: fedora:32
  script:
    - dnf group install -y 'Development Tools'
    - dnf install -y hdf5-devel gsl-devel flex bison gcc-c++
    - dnf install -y gtk3-devel cairo-devel pango-devel gdk-pixbuf2-devel fftw-devel libpng-devel diffutils
    - dnf install -y meson
    - meson build && ninja -C build
    - ninja -C build test

build-meson-nohdf5:
  image: fedora:37
  script:
    - dnf group install -y 'Development Tools'
    - dnf install -y gsl-devel flex bison gcc-c++
    - dnf install -y gtk3-devel cairo-devel pango-devel gdk-pixbuf2-devel fftw-devel libpng-devel diffutils
    - dnf install -y meson
    - meson build -Dhdf5=disabled && ninja -C build
    - ninja -C build test

build_container_image:
  stage: build_container
  only:
    - master
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [ "" ]

  variables:
    IMAGE: "crystfel"
    IMAGE_TAG_LATEST: "latest"
    IMAGE_TAG_SHA: $CI_COMMIT_SHORT_SHA
    DOCKER_HOST: tcp://docker:2375
    DOCKER_TLS_CERTDIR: ""

  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
      --destination $CI_REGISTRY_IMAGE/$IMAGE:$IMAGE_TAG_LATEST
      --destination $CI_REGISTRY_IMAGE/$IMAGE:$IMAGE_TAG_SHA
      --build-arg HELM_VERSION=$HELM_VERSION
      --build-arg RANCHER_CLI_VERSION=$RANCHER_CLI_VERSION

  tags:
    - kubernetes

build_container_image_tag:
  stage: build_container
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [ "" ]

  variables:
    IMAGE: "crystfel"
    IMAGE_TAG_VER: $CI_COMMIT_TAG
    DOCKER_HOST: tcp://docker:2375
    DOCKER_TLS_CERTDIR: ""

  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
      --destination $CI_REGISTRY_IMAGE/$IMAGE:$IMAGE_TAG_VER
      --build-arg HELM_VERSION=$HELM_VERSION
      --build-arg RANCHER_CLI_VERSION=$RANCHER_CLI_VERSION

  tags:
    - kubernetes

  rules:
    - if: $CI_COMMIT_TAG

build-native-macos:
  tags:
    - macOS
  variables:
    GIT_STRATEGY: clone
  script:
    - brew update
    - brew upgrade
    - brew install gsl hdf5 flex bison argp-standalone pkg-config doxygen gtk+3 cairo pango gdk-pixbuf fftw meson ninja python python-tk
    - export PATH="$(brew --prefix)/opt/bison/bin:$(brew --prefix)/opt/flex/bin:$PATH"
    - export LDFLAGS="-L$(brew --prefix)/opt/bison/lib -L$(brew --prefix)/opt/flex/lib -L$(brew --prefix)/opt/argp-standalone/lib -largp $LDFLAGS"
    - export CFLAGS="-I$(brew --prefix)/opt/flex/include -I$(brew --prefix)/opt/argp-standalone/include/ $CFLAGS"
    - meson build
    - ninja -C build
    - ninja -C build test

build-brew-macos:
  stage: test_brew
  tags:
    - macOS
  variables:
    GIT_STRATEGY: clone
  script:
    - brew update
    - brew upgrade
    - brew install gsl hdf5 flex bison argp-standalone pkg-config doxygen gtk+3 cairo pango gdk-pixbuf fftw meson ninja python python-tk
    - brew uninstall -v -f crystfel
    - brew install -v -s ./crystfel.rb --HEAD
    - brew uninstall -v -f crystfel

build-centos7:
  image: centos:centos7
  #image:centos:latest
  #image: centos:centos7.9.2009
  variables:
    SECURE_FILES_DOWNLOAD_PATH: './downloads'
  script:
    - yum update -y
    - yum group install -y "Development Tools"
    - yum install -y wget lz4 lz4-devel bzip2-libs bzip2-devel python3 gtk3-devel
    - curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash
    - python3 -m pip  install meson ninja
    - wget https://gitlab.desy.de/thomas.white/install-crystfel/-/raw/main/run-me-desy-maxwell-centos7
    - chmod 755 ./run-me-desy-maxwell-centos7
    - ./run-me-desy-maxwell-centos7 --yes-really
  artifacts:
    paths:
      - software/
    when: on_success
    expire_in: 1 day
    
build-maxwell:
  tags:
    - maxwell
  variables:
    GIT_STRATEGY: clone
  script:
    - wget https://gitlab.desy.de/fs-sc/install-crystfel/-/raw/main/run-me-desy-maxwell-local
    - chmod 755 ./run-me-desy-maxwell-local
    - ./run-me-desy-maxwell-local --yes-really
  artifacts:
    paths:
      - software/
    when: on_success
    expire_in: 1 day
  rules:
    - if: $MAXWELL_DEPLOYMENT == "local"

deploy-local-maxwell:
  stage: deploy
  variables:
    GIT_STRATEGY: none
  tags: 
    - maxwell
  script:
   - if [ -d ~/software/crystfel/devel ]; then
        mv -f ~/software/crystfel/devel ~/software/crystfel/devel-`date +%F-%H:%M:%S`;
     fi
   - cp -rv software/crystfel/devel ~/software/crystfel/
  rules:
    - if: $MAXWELL_DEPLOYMENT == "local"  &&  $CI_COMMIT_BRANCH == "master"

deploy-remote-maxwell:
  stage: deploy
  image: centos:centos7
  variables:
    GIT_STRATEGY: none
  tags:
    - DESY-intern
  before_script:
  ##
  ## Install ssh-agent or kerberos client if not already installed, it is required by Docker.
  ## (change apt-get to yum if you use an RPM-based image)
  ## Run ssh-agent (inside the build environment)
  ## Give the right permissions, otherwise ssh-add will refuse to add files
  ## Add the SSH key stored in MAXWELL_SSH_PRIVATE_KEY file type CI/CD variable to the agent store
  ## Create the SSH directory and give it the right permissions
  ## If MAXWELL_SSH_PRIVATE_KEY is not set then use $MAXWELL_USER_NAME and $MAXWELL_ACCOUNT_PASSWORD
  ## to connect using Kerberos.
  - yum update -y
  - yum install -y wget
  - if [ $MAXWELL_SSH_PRIVATE_KEY ]; then
        command -v ssh-agent >/dev/null || ( yum install openssh-clients -y );
        eval $(ssh-agent -s);
        chmod 400 "$MAXWELL_SSH_PRIVATE_KEY";
        ssh-add "$MAXWELL_SSH_PRIVATE_KEY";
        mkdir -p ~/.ssh;
        chmod 700 ~/.ssh;
    else
        yum install -y openssh-clients  krb5-workstation;
        echo $MAXWELL_ACCOUNT_PASSWORD | kinit $MAXWELL_USER_NAME@DESY.DE;
    fi
  - wget -q https://wims.desy.de/system/ALL_afs/etc/ssh_known_hosts2 -O ~/.ssh/known_hosts
  script:
   - ssh   $MAXWELL_USER_NAME@max-wgs
     "if [ -d /software/crystfel/devel ]; then
        mv -f /software/crystfel/devel /software/crystfel/devel-`date +%F-%H:%M:%S`;
     fi"
   - scp -r software/crystfel/devel $MAXWELL_USER_NAME@max-wgs:/software/crystfel/
  rules:
    - if: $MAXWELL_DEPLOYMENT == "remote"  && $CI_COMMIT_BRANCH == "master"