-
Notifications
You must be signed in to change notification settings - Fork 5
/
.gitlab-ci.yml
97 lines (89 loc) · 2.56 KB
/
.gitlab-ci.yml
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
# You'll need to activate pipelines for this file to have any effect
# in gitlab, go to Settings -> General -> Permissions -> Pipeline
stages:
- lint
- test
- deb
- deploy
include:
- project: 'grid5000/grid5000-gitlab-templates'
ref: master
file: '/sonarqube.yml'
include:
- project: 'grid5000/grid5000-gitlab-templates'
ref: master
file: '/rubocop-rails.yml'
.install-deps:
before_script:
- echo "deb [ trusted=yes ] http://packages.grid5000.fr/deb/g5k-deb-build-tools/bookworm /" > /etc/apt/sources.list.d/g5k-deb-build-tools.list
- apt-get update && apt-get -y --no-install-recommends install devscripts build-essential equivs libssl-dev
- mk-build-deps -ir -t 'apt-get -y --no-install-recommends'
- gem install bundler -v 2.3.22
- bundle config set path 'vendor/bundle'
test-for-bookworm: &test-for-bookworm
image: debian:bookworm
stage: test
services:
- name: mariadb:10.3
alias: mysql
- name: postgres
tags:
- grid5000-docker
variables:
RAILS_ENV: test
MYSQL_ROOT_PASSWORD: uheiN4pe
MYSQL_DATABASE: g5kapi_test
MYSQL_USER: g5kapi
MYSQL_PASSWORD: Pe9IeCei
POSTGRES_USER: oar
POSTGRES_PASSWORD: oar
POSTGRES_DB: oar2_test
before_script: !reference [.install-deps, before_script]
script:
- bundle install -j 4
- bundle exec rake db:migrate
- bundle exec rake db:oar:seed
- bundle exec rspec spec/
artifacts:
when: on_failure
paths:
- log/test.log
expire_in: '1 week'
coverage: '/\(\d+.\d+\%\) covered/'
except:
- tags
deb-for-bookworm: &deb-for-bookworm
image: debian:bookworm
stage: deb
tags:
- grid5000-docker
before_script: !reference [.install-deps, before_script]
script:
- apt-get install -y curl pkg-config
- rm -f ../*deb
- dpkg-buildpackage
- cp ../*deb .
artifacts:
paths:
- ./*.deb
expire_in: '1 day'
except:
- tags
.push-packages-script: &push-packages-script |
echo "Request to push for debian version ${TARGET_DEBIAN_VERSION} for branch ${TARGET_G5K_API_VARIANT}"
g5k-deploy-files --only-if-tag '^v\d+\.\d+\.\d+' --debian --directory deb/g5k-api/${TARGET_DEBIAN_VERSION}
push-bookworm-package: &push-bookworm-package
stage: deploy
when: manual
allow_failure: false
# tags must be 'packages' so that we use the runner on packages.grid5000.fr
tags:
- grid5000-packages
only: # we only execute this job for tagged commits on the master branch
- master
dependencies:
- deb-for-bookworm
variables:
TARGET_DEBIAN_VERSION: bookworm
script:
- *push-packages-script