-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
118 lines (100 loc) · 3.86 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
stages:
- test
- deploy
image: vkehayas/alpine-r-doc-plot:1.1.1
before_script:
##
## Install ssh-agent if not already installed, it is required by Docker.
## (change apt-get to yum if you use an RPM-based image)
##
- 'apk update && apk add openssh-client && apk add git && apk add bash'
## - apk update && apk add openssh-client git
## - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
##
## Run ssh-agent (inside the build environment)
##
- eval $(ssh-agent -s)
##
## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
## We're using tr to fix line endings which makes ed25519 keys work
## without extra base64 encoding.
## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
##
- bash -c 'ssh-add <(echo "$SSH_PRIVATE_KEY")'
## - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
##
## Create the SSH directory and give it the right permissions
##
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
##
## Use ssh-keyscan to scan the keys of your private server. Replace gitlab.com
## with your own domain name. You can copy and repeat that command if you have
## more than one server to connect to.
##
- ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
##
## Alternatively, assuming you created the SSH_SERVER_HOSTKEYS variable
## previously, uncomment the following two lines instead.
##
#- echo "$SSH_SERVER_HOSTKEYS" > ~/.ssh/known_hosts'
#- chmod 644 ~/.ssh/known_hosts
##
## You can optionally disable host key checking. Be aware that by adding that
## you are suspectible to man-in-the-middle attacks.
## WARNING: Use this only with the Docker executor, if you use it with shell
## you will overwrite your user's SSH config.
##
#- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
##
## Optionally, if you will be using any Git commands, set the user name and
## email.
##
- git config --global user.email "[email protected]"
- git config --global user.name "Neurath's Boat"
test:
stage: test
script:
# try to connect to GitLab.com
- ssh [email protected]
# try to clone yourself. A *PUBLIC* key paired to the SSH_PRIVATE_KEY was added as deploy key to this repository
- git clone [email protected]:neurathsboat.blog/posts/glmm-theory.git
# Check default R path
- Rscript -e "getwd();
setwd('glmm-theory');
getwd();
writeLines('test', 'spam.txt');
system('ls -la')"
# Check access to MRAN (https://github.com/RevolutionAnalytics/checkpoint)
- Rscript -e "setwd('glmm-theory');
cranRepo = 'https://cloud.r-project.org/';
buildDate0 = '2019-01-01';
install.packages('checkpoint', repos = cranRepo);
system('mkdir /root/.checkpoint');
library(checkpoint);
checkpoint(buildDate0)"
# Test git commit
- cd "glmm-theory"
- git add .
- git commit -m "Test commit"
- echo All tests have succeeded!
deploy:
stage: deploy
script:
- bash
- git clone [email protected]:neurathsboat.blog/posts/glmm-theory.git
- Rscript -e "cranRepo = 'https://cloud.r-project.org/';
buildDate = '2019-01-05';
install.packages('checkpoint', repos = cranRepo);
system('mkdir /root/.checkpoint');
library(checkpoint);
checkpoint(buildDate);
library(rmarkdown);
setwd('glmm-theory/src');
render('glmm-theory.Rmd', output_file = 'index.md');
source('ProcessRmd.R')"
- cd glmm-theory
- git add .
- git commit -m "CI commit"
- git push -u origin master