-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml.DONT_RUN
145 lines (136 loc) · 5.87 KB
/
.gitlab-ci.yml.DONT_RUN
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
###
# GCAT .gitlab-ci.yml
# - uses our standard WEI docker container
# - webapp prereqs are installed during gitlab ci (instead of in a custom base image)
# - cached folders (per branch) store webapp prereqs and ruby gems to speed up ci
###
image: registry.glbrc.org/ci/weiror:1.3
#services:
# - mariadb:10.1
stages:
- test
cache:
# key sets cache to exist per-branch
# can set to use any preset env var -- https://docs.gitlab.com/ce/ci/variables/README.html
# only persist the named directories below
key: "$CI_COMMIT_REF_NAME"
paths:
- apt/
- prereqs/
- vendor/
variables:
# mariadb
MYSQL_DATABASE: webappdb
MYSQL_USER: dbuser
MYSQL_PASSWORD: dbuser_p@ssword
MYSQL_ROOT_PASSWORD: dbroot_p@ssword
# webapp
RAILS_ENV: production
MY_DATABASE: 'yes'
MY_SECRETS: 'yes'
MY_SETTINGS: 'yes'
APT_UPDATES: 'no'
DB_CONTAINER: mariadb
MARIADB_ENV_MYSQL_DATABASE: webappdb
MARIADB_ENV_MYSQL_USER: dbuser
MARIADB_ENV_MYSQL_PASSWORD: dbuser_p@ssword
MARIADB_ENV_MYSQL_ROOT_PASSWORD: dbroot_p@ssword
before_script:
- sed -i -e "$ a\export CI_HOME=`pwd`" /home/app/.bashrc
- sed -i -e "$ a\export CI_HOME=`pwd`" /home/app/.profile
- export CI_HOME=`pwd`
- cp -a $(pwd)/. /home/app/webapp
- /etc/my_init.d/11_chownapphome.sh
- /etc/my_init.d/13_environment_config.sh
- /etc/my_init.d/15_customizations.sh
- /etc/my_init.d/19_misc.sh
- /etc/my_init.d/21_chownapphome.sh
## GCAT prereqs
# - install Extremely Naive Charset Analyser
# - enca is used in rspec testing
# - install R -- get key, install base from apt repo
# - get key, install base from apt-repo
# - install GCAT R package
# - install a million R dependencies
# - this was done in a crappy copy-paste way from the CRAN website
# - future: maybe there's a way to automate dependency install on the command line?
# - note: order of install is IMPORTANT here for R package install
# enca v1.19
- cd $CI_HOME
- git clone https://github.com/nijel/enca.git prereqs/enca
- cd prereqs/enca
- ./configure
- make
- make check
- make install
# R
- cd $CI_HOME
- mkdir -p apt
- echo "deb http://cran.rstudio.com/bin/linux/ubuntu xenial/" | tee -a /etc/apt/sources.list
- gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
- gpg -a --export E084DAB9 | apt-key add -
- apt-get -o dir::cache::archives="apt" install -y -qq r-base r-base-dev fontconfig wget
# R packages
- cd $CI_HOME
- echo 'options(repos = c(CRAN = "https://cran.rstudio.com/"), download.file.method = "libcurl")' >> /etc/R/Rprofile.site
- mkdir -p prereqs/R
- cp -a GCAT_info/R/. prereqs/R
- cd prereqs/R
- curl -O https://cran.r-project.org/src/contrib/pheatmap_1.0.8.tar.gz
- curl -O https://cran.r-project.org/src/contrib/gplots_3.0.1.tar.gz
- curl -O https://cran.r-project.org/src/contrib/gtable_0.2.0.tar.gz
- curl -O https://cran.r-project.org/src/contrib/Rcpp_0.12.10.tar.gz
- curl -O https://cran.r-project.org/src/contrib/labeling_0.3.tar.gz
- curl -O https://cran.r-project.org/src/contrib/colorspace_1.3-2.tar.gz
- curl -O https://cran.r-project.org/src/contrib/plyr_1.8.4.tar.gz
- curl -O https://cran.r-project.org/src/contrib/dichromat_2.0-0.tar.gz
- curl -O https://cran.r-project.org/src/contrib/RColorBrewer_1.1-2.tar.gz
- curl -O https://cran.r-project.org/src/contrib/munsell_0.4.3.tar.gz
- curl -O https://cran.r-project.org/src/contrib/scales_0.4.1.tar.gz
- curl -O https://cran.r-project.org/src/contrib/KernSmooth_2.23-15.tar.gz
- curl -O https://cran.r-project.org/src/contrib/bitops_1.0-6.tar.gz
- curl -O https://cran.r-project.org/src/contrib/caTools_1.17.1.tar.gz
- curl -O https://cran.r-project.org/src/contrib/gtools_3.5.0.tar.gz
- curl -O https://cran.r-project.org/src/contrib/gdata_2.17.0.tar.gz
- R CMD INSTALL gtable_0.2.0.tar.gz
- R CMD INSTALL Rcpp_0.12.10.tar.gz
- R CMD INSTALL labeling_0.3.tar.gz
- R CMD INSTALL colorspace_1.3-2.tar.gz
- R CMD INSTALL plyr_1.8.4.tar.gz
- R CMD INSTALL dichromat_2.0-0.tar.gz
- R CMD INSTALL RColorBrewer_1.1-2.tar.gz
- R CMD INSTALL munsell_0.4.3.tar.gz
- R CMD INSTALL scales_0.4.1.tar.gz
- R CMD INSTALL pheatmap_1.0.8.tar.gz
- R CMD INSTALL KernSmooth_2.23-15.tar.gz
- R CMD INSTALL bitops_1.0-6.tar.gz
- R CMD INSTALL caTools_1.17.1.tar.gz
- R CMD INSTALL gtools_3.5.0.tar.gz
- R CMD INSTALL gdata_2.17.0.tar.gz
- R CMD INSTALL gplots_3.0.1.tar.gz
- R CMD INSTALL GCAT_6.3.1.tar.gz
# phantomjs 2.1.1
# apt-get installs merged into single command above
#- apt-get -o dir::cache::archives="apt" install -y -qq fontconfig wget
- cd $CI_HOME
- mkdir -p prereqs/phantomjs
- if [ ! -f prereqs/phantomjs/bin/phantomjs ]; then wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2; tar -xjvf phantomjs-2.1.1-linux-x86_64.tar.bz2 --strip-components 1 -C prereqs/phantomjs/; fi
- ln -s `pwd`/prereqs/phantomjs/bin/phantomjs /usr/local/bin/phantomjs
## general webapp config
# install gems
- mkdir -p vendor
- su - app -lc 'cd /home/app/webapp && gem install bundler --no-ri --no-rdoc'
- su - app -lc 'cd /home/app/webapp && bundle install --with test ci --without development production --jobs $(nproc) --path $CI_HOME/vendor'
# dynamically generate $SECRET_KEY_BASE
- su - app -lc 'cd /home/app/webapp && echo export SECRET_KEY_BASE=${SECRET_KEY_BASE:=`bundle exec rake secret`}' | tee -a /home/app/.profile /home/app/.bashrc
rails_env=test_with_rspec:
stage: test
script:
# see GCAT_info/GCAT_Roadmap.txt for info on these rpsec tests
- su - app -lc 'cd /home/app/webapp && RAILS_ENV=test bundle exec rspec spec/features/'
- su - app -lc 'cd /home/app/webapp && RAILS_ENV=test bundle exec rspec spec/unit'
- su - app -lc 'cd /home/app/webapp && RAILS_ENV=test bundle exec rspec spec/integration'
#rails_env=ci:
# stage: test
# script:
# stub GCAT test command for rails_env=ci