forked from mtiller/ModelicaBook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
127 lines (114 loc) · 3.62 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
119
120
121
122
123
124
125
126
127
# By default, all commands are done in the context of the mtiller/book-builder
# Docker image (unless the individual jobs override this)
image: mtiller/book-builder
variables:
# Be sure to extract submodules
GIT_SUBMODULE_STRATEGY: normal
# Use this for performance reasons
DOCKER_DRIVER: overlay2
# Cache the text/results and text/plots directories across jobs
cache:
paths:
- text/results
- text/plots
# Needed for cases where we are running docker. We use the 'docker' image
# but it depends on this service being present (not sure how/why).
services:
- docker:dind
# The various stages
stages:
- generating_results
- installing_image_dependencies
- building_image
- publishing_image
- generating_json
- generating_ebooks
- generating_site
generate_specs:
stage: generating_results
script:
- (cd text; make specs)
- (cd text; make results)
artifacts:
paths:
- text/results/exes.tar.gz
- text/plots
# We do this for all branches just to make sure there
# are no errors.
install_image_dependencies:
image: node:10-jessie
stage: installing_image_dependencies
script:
- (cd api; make deps)
# We do this for all branches just to make sure there are no errors
publish_image:
image: docker:stable
stage: publishing_image
script:
- mkdir api/models
# TODO: Create a version that downloads these files at startup? Decouples
# the API server entirely from the Book source!
- (cd api/models; tar xf ../../text/results/exes.tar.gz)
- (cd api; docker build -t mtiller/book-server .)
- docker login -u $DOCKER_USER -p $DOCKER_PASS
- docker push mtiller/book-server
when: manual
artifacts:
paths:
- api
generate_json:
stage: generating_json
script:
- (cd text; make json)
artifacts:
paths:
- text/build/
generate_epub_and_mobi:
stage: generating_ebooks
script:
- (cd text; make ebooks)
- mv text/build/epub/ModelicaByExample.epub text/build/epub/ModelicaByExample-`git hash-object text/build/epub/ModelicaByExample.epub`.epub
- mv text/build/mobi/ModelicaByExample.mobi text/build/mobi/ModelicaByExample-`git hash-object text/build/mobi/ModelicaByExample.mobi`.mobi
when: manual
artifacts:
paths:
- text/build/epub/ModelicaByExample*.epub
- text/build/mobi/ModelicaByExample*.mobi
generate_pdf:
stage: generating_ebooks
script:
- (cd text; make pdf)
- mv text/build/latex/ModelicaByExample.pdf text/build/latex/ModelicaByExample-Letter-`git hash-object text/build/latex/ModelicaByExample.pdf`.pdf
when: manual
artifacts:
paths:
- text/build/latex/ModelicaByExample-Letter-*.pdf
generate_pdfa4:
stage: generating_ebooks
script:
- (cd text; make pdf-a4)
- mv text/build/latex-a4/ModelicaByExample.pdf text/build/latex-a4/ModelicaByExample-A4-`git hash-object text/build/latex-a4/ModelicaByExample.pdf`.pdf
when: manual
artifacts:
paths:
- text/build/latex-a4/ModelicaByExample-A4-*.pdf
generate_preview_site:
image: node:10-jessie
stage: generating_site
except:
- master
script:
- (cd nextgen; make publish_site alias_preview)
artifacts:
paths:
- nextgen/out
generate_production_site:
image: node:10-jessie
stage: generating_site
only:
- master
script:
- (cd nextgen; make publish_site alias_release)
artifacts:
paths:
- nextgen/out