Newer
Older
# This file is a template, and might need editing before it works on your project.
# Full project: https://gitlab.com/pages/plain-html
# always test the preprocessor with unit tests
test-preprocessor:
stage: testing
allow_failure: false
image:
name: alpine:latest
script:
- apk add --no-cache --upgrade bash
- RESEARCH_ROOT=`pwd`; export RESEARCH_ROOT;
# run shell script with testss
- $RESEARCH_ROOT/bin/run-tests.sh
artifacts:
paths:
- testing/*.log
only:
refs:
- branches
- merge_requests
changes:
- .gitlab-ci.yml
- bin
- testing
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
# always test the pandoc integration and pandoc build with unit tests
pandoc-test:
stage: testing
allow_failure: false
image:
name: alpine:latest
script:
- apk add --no-cache --upgrade bash
- RESEARCH_ROOT=`pwd`; export RESEARCH_ROOT;
# run shell script with testss
- $RESEARCH_ROOT/bin/test_pandoc.sh
artifacts:
paths:
- testing/test_pandoc/*.log
# test that markdown is translated correctly
test-md-to-html:
stage: testing
allow_failure: false
image:
name: eltenedor/ubuntu-pandoc:latest
script:
- mkdir -p log
- rm -rf log/test_create_html.log
- RESEARCH_ROOT=`pwd`; export RESEARCH_ROOT;
- $RESEARCH_ROOT/bin/test_create_html.sh | tee log/test_create_html.log
artifacts:
paths:
- log/test_create_html.log
only:
refs:
- branches
- merge_requests
changes:
- .gitlab-ci.yml
- bin
- testing
# test that html is included correctly
test-replace_marker:
stage: testing
allow_failure: false
image:
name: eltenedor/ubuntu-pandoc:latest
script:
- mkdir -p log
- rm -rf log/test_replace_marker.log
- RESEARCH_ROOT=`pwd`; export RESEARCH_ROOT;
- $RESEARCH_ROOT/bin/test_replace_marker.sh | tee log/test_replace_marker.log
artifacts:
paths:
- log/test_replace_marker.log
only:
refs:
- branches
- merge_requests
changes:
- .gitlab-ci.yml
- bin
- testing
# test building standalone static webpage
test-build-standalone:
stage: testing
allow_failure: false
image:
name: eltenedor/ubuntu-pandoc:latest
script:
- mkdir -p log
- rm -rf log/test_build_standalone.log
- RESEARCH_ROOT=`pwd`; export RESEARCH_ROOT;
- $RESEARCH_ROOT/bin/test_build_standalone.sh | tee log/test_build_standalone.log
artifacts:
paths:
- log/test_build_standalone.log
only:
refs:
- branches
- merge_requests
changes:
- .gitlab-ci.yml
- bin
- testing
# build standalone static webpage
build-standalone-static:
stage: build
allow_failure: false
image:
name: eltenedor/ubuntu-pandoc:latest
script:
- RESEARCH_ROOT=`pwd`; export RESEARCH_ROOT;
# build static webpage
- $RESEARCH_ROOT/bin/build_standalone.sh
artifacts:
paths:
- public
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_BRANCH
# build standalone static webpage
build-static:
stage: build
allow_failure: false
image:
name: eltenedor/ubuntu-pandoc:latest
script:
- RESEARCH_ROOT=`pwd`; export RESEARCH_ROOT;
# build static webpage
- $RESEARCH_ROOT/bin/build_static.sh
artifacts:
paths:
- static
rules:
- if: $CI_MERGE_REQUEST_ID
# build tuhh-snippets
build-tuhh:
stage: build
allow_failure: false
image:
name: eltenedor/ubuntu-pandoc:latest
script:
- RESEARCH_ROOT=`pwd`; export RESEARCH_ROOT;
- $RESEARCH_ROOT/bin/preproc_topics.sh $RESEARCH_ROOT/build-tuhh $RESEARCH_ROOT/topics
- $RESEARCH_ROOT/bin/create_html.sh $RESEARCH_ROOT/build-tuhh $RESEARCH_ROOT/build-tuhh
artifacts:
paths:
- build-tuhh
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_BRANCH
# deploy static webpage on issue-branch to web-server hosted asteroids
deploy-on-asteroid:
stage: review
image:
name: alpine:latest
before_script:
## install dependencies
#- apk update && apk add openssh-client bash
## see https://docs.gitlab.com/ee/ci/ssh_keys/ for comments
#- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )' #this command is for debian based systems
- apk update && apk add openssh-client bash #this command is for alpine
- eval $(ssh-agent -s)
- echo "$ASTEROID_SSH_KEY" | tr -d '\r' | ssh-add -
# See https://stackoverflow.com/a/57332478 about known hosts
- mkdir -p ~/.ssh && touch ~/.ssh/known_hosts
- echo "$ASTEROID_KNOWN_HOSTS" >> ~/.ssh/known_hosts
- chmod 700 ~/.ssh
script:
- mkdir .public-asteroid
- cp -r public/*.html .public-asteroid
- cp -r img .public-asteroid
- cp -r css .public-asteroid
- mv .public-asteroid public-asteroid
# deploy webpage on asteroid

Fabian Nuraddin Alexander Gabel
committed
- ssh $ASTEROID_USER@$ASTEROID_HOST "rm -rf $ASTEROID_DEPLOY/$CI_COMMIT_REF_NAME"
- scp -v -r public-asteroid "$ASTEROID_USER@$ASTEROID_HOST:$ASTEROID_DEPLOY/$CI_COMMIT_REF_NAME"
artifacts:
paths:
- public-asteroid
rules:
- if: $CI_PROJECT_URL != 'https://collaborating.tuhh.de/cfg0846/research-topics-mat-tuhh'
when: never
- when: always
# deploy static webpage on dev-branch to tuhh
deploy-on-tuhh:
stage: deploy
image:
name: alpine:latest
before_script:
## install dependencies
- apk update && apk add openssh-client bash
## see https://docs.gitlab.com/ee/ci/ssh_keys/ for comments
#- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$TUHH_SSH_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh && touch ~/.ssh/known_hosts
- echo "$TUHH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
- chmod 700 ~/.ssh
script:
- cp -r build-tuhh .public-tuhh
- mv .public-tuhh public-tuhh
# deploy webpage on tuhh
- echo 'scp -v public-tuhh' "$TUHH_USER@$TUHH_HOST:$TUHH_DEPLOY"
- scp -v -r public-tuhh "$TUHH_USER@$TUHH_HOST:$TUHH_DEPLOY"
artifacts:
paths:
- public-tuhh
rules:
- if: $CI_PROJECT_URL != 'https://collaborating.tuhh.de/cfg0846/research-topics-mat-tuhh'
when: never
- if: $CI_COMMIT_BRANCH == 'dev'
when: always
# deploy static webpage to web-server via GitLab pages
- mkdir .public-pages
- cp -r public .public-pages
- mv .public-pages public-pages
deploy_review:
stage: deploy
script:
- echo "Deploy a review app"
environment:
name: review/$CI_COMMIT_REF_NAME
url: https://review.fabian-gabel.de/$CI_COMMIT_REF_NAME
# on_stop: stop_review_app
# auto_stop_in: 1 week
rules:
- if: $CI_PROJECT_URL != 'https://collaborating.tuhh.de/cfg0846/research-topics-mat-tuhh'
when: never
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_BRANCH == 'dev'
# uncomment for manual stopping
#stop_review_app:
# stage: deploy
# script: stop-review-app
# environment:
# name: review/$CI_COMMIT_REF_NAME
# action: stop
# rules:
# - if: $CI_MERGE_REQUEST_ID