forked from modelica/ModelicaSpecification
/
Jenkinsfile
144 lines (144 loc) · 4.76 KB
/
Jenkinsfile
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
pipeline {
agent none
options {
disableConcurrentBuilds()
}
stages {
stage('checks') {
agent {
docker {
image 'alpine:3.9'
label 'linux'
}
}
steps {
sh label: "Find files with trailing whitespace", script: '! grep -n "[ \t]$" *.tex chapters/*.tex'
}
}
stage('build') {
agent {
docker {
image 'modelicaspec/latexml:20210330'
label 'linux'
alwaysPull true
}
}
environment {
HOME = '/tmp/jenkins'
}
steps {
sh 'mkdir -p /tmp/jenkins'
sh 'latexmk -pdf MLS.tex'
sh 'latexml MLS.tex --includestyles --path=media --dest MLS.xml'
sh 'latexmlpost MLS.xml -format html -pmml --splitat=chapter --splitnaming=labelrelative --javascript=LaTeXML-maybeMathjax.js --navigationtoc=context --css=css/MLS.css --css=css/MLS-navbar-left.css --dest MLS.html'
sh '.scripts/patch-viewport.sh'
sh 'ln -s preface.html Chx1.html'
sh 'ln -s lexical-structure.html Ch2.html'
sh 'ln -s operators-and-expressions.html Ch3.html'
sh 'ln -s class-predefined-types-and-declarations.html Ch4.html'
sh 'ln -s scoping-name-lookup-and-flattening.html Ch5.html'
sh 'ln -s interface-or-type-relationships.html Ch6.html'
sh 'ln -s inheritance-modification-and-redeclaration.html Ch7.html'
sh 'ln -s equations.html Ch8.html'
sh 'ln -s connectors-and-connections.html Ch9.html'
sh 'ln -s arrays.html Ch10.html'
sh 'ln -s statements-and-algorithm-sections.html Ch11.html'
sh 'ln -s functions.html Ch12.html'
sh 'ln -s packages.html Ch13.html'
sh 'ln -s overloaded-operators.html Ch14.html'
sh 'ln -s stream-connectors.html Ch15.html'
sh 'ln -s synchronous-language-elements.html Ch16.html'
sh 'ln -s state-machines.html Ch17.html'
sh 'ln -s annotations.html Ch18.html'
sh 'ln -s unit-expressions.html Ch19.html'
sh 'ln -s the-modelica-standard-library.html Ch20.html'
sh 'ln -s modelica-concrete-syntax.html A2.html'
sh 'ln -s modelica-dae-representation.html A3.html'
sh 'ln -s derivation-of-stream-equations.html A4.html'
sh 'ln -s modelica-revision-history.html A5.html'
sh 'ln -s bib.html A6.html'
sh 'ln -s bib.html literature.html'
sh script: '! (find . -type l -xtype l | egrep \'.*\')', label: 'Verify symbolic links work'
sh 'tar czf MLS.tar.gz *.html *.css *.js media/ css/'
archiveArtifacts artifacts: 'MLS.tar.gz', fingerprint: true
archiveArtifacts artifacts: 'MLS.pdf', fingerprint: true
stash name: 'MLS', includes: '*.html,*.css,*.js,MLS.pdf,media/**,css/**,MLS.tar.gz'
}
}
stage('upload') {
when {
allOf {
not {
changeRequest()
}
anyOf {
buildingTag()
anyOf {
branch 'jenkins'
branch 'master'
branch 'maint/**'
}
}
}
beforeAgent true
}
agent {
label 'linux'
}
steps {
unstash name: 'MLS'
sh "test ! -z ${env.GIT_BRANCH}"
sshagent (credentials: ['Hudson-SSH-Key']) {
sh 'ssh-keyscan github.com >> ~/.ssh/known_hosts'
sh "test -d specification.modelica.org || git clone git@github.com:modelica/specification.modelica.org"
sh "cd specification.modelica.org/ && git fetch && git reset --hard origin/master"
sh "rm -rf 'specification.modelica.org/${env.GIT_BRANCH}' && mkdir -p 'specification.modelica.org/${env.GIT_BRANCH}'"
sh "cp -a *.html *.css *.js MLS.pdf media css 'specification.modelica.org/${env.GIT_BRANCH}'"
sh """
cd specification.modelica.org
git add '${env.GIT_BRANCH}'
if ! git diff-index --quiet origin/master --; then
git commit --amend -m "Initial commit"
git push -f
fi
"""
}
}
}
stage('index') {
agent {
docker {
image 'modelicaspec/markdown:20190307'
label 'linux'
alwaysPull true
}
}
when {
allOf {
not {
changeRequest()
}
branch 'master'
}
beforeAgent true
}
steps {
sh 'python3 .CI/index.py'
sshagent (credentials: ['Hudson-SSH-Key']) {
sh 'ssh-keyscan github.com >> ~/.ssh/known_hosts'
sh "test -d specification.modelica.org || git clone git@github.com:modelica/specification.modelica.org"
sh "cd specification.modelica.org/ && git fetch && git reset --hard origin/master"
sh "cp -a index.html specification.modelica.org/"
sh """
cd specification.modelica.org
git add index.html
if ! git diff-index --quiet origin/master --; then
git commit --amend -m "Initial commit"
git push -f
fi
"""
}
}
}
}
}