.gitlab-ci.yml 7.65 KB
Newer Older
Sébastien Villemot's avatar
Sébastien Villemot committed
1
variables:
2
  GIT_SUBMODULE_STRATEGY: recursive
3
  TERM: linux
4
  MATLAB_VERSION: R2020a
5
  OLD_MATLAB_VERSION: R2014a
Sébastien Villemot's avatar
Sébastien Villemot committed
6

7 8 9 10 11
# The next stanza creates the version number used for the source tarball and the
# binary packages. Here are the following possible cases:
# - if VERSION was already set (when manually running a pipeline), use it
# - if we are in the official Dynare repository:
#   + if on a tag: use the tag
12
#   + if on master: use 4.7-unstable-$TIMESTAMP-$COMMIT
13 14 15
#   + on another branch: use $BRANCH-$TIMESTAMP-$COMMIT
# - if in a personal repository: use $USER-$TIMESTAMP-$COMMIT
before_script:
16
  - '[[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Dynare ]] && [[ -n $CI_COMMIT_TAG ]] && export VERSION=$CI_COMMIT_TAG'
17
  - '[[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Dynare ]] && [[ $CI_COMMIT_REF_NAME == master ]] && export VERSION=4.7-unstable-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA'
18 19
  - '[[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Dynare ]] && export VERSION=$CI_COMMIT_REF_NAME-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA'
  - '[[ -z $VERSION ]] && export VERSION=$CI_PROJECT_NAMESPACE-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA'
20

21 22 23 24 25
stages:
  - build
  - test_and_pkg
  - deploy

Sébastien Villemot's avatar
Sébastien Villemot committed
26 27 28 29
build_binaries:
  stage: build
  script:
    - autoreconf -si
30
    - ./configure --with-matlab=/usr/local/MATLAB/$MATLAB_VERSION MATLAB_VERSION=$MATLAB_VERSION PACKAGE_VERSION=$VERSION PACKAGE_STRING="dynare $VERSION"
Sébastien Villemot's avatar
Sébastien Villemot committed
31
    - make -j $(nproc) LN_S="cp -p"
Sébastien Villemot's avatar
Sébastien Villemot committed
32 33
  artifacts:
    paths:
Sébastien Villemot's avatar
Sébastien Villemot committed
34
      - matlab/preprocessor*/*
Sébastien Villemot's avatar
Sébastien Villemot committed
35 36
      - mex/octave/
      - mex/matlab/
37
      - dynare++/parser/cc/*_tab.cc
38
      - dynare++/parser/cc/*_tab.hh
39 40
      - dynare++/parser/cc/*_ll.cc
      - dynare++/src/*_tab.cc
41
      - dynare++/src/*_tab.hh
42 43 44 45 46 47
      - dynare++/src/*_ll.cc
      - dynare++/*/*.o
      - dynare++/*/*.a
      - dynare++/*/*/*.o
      - dynare++/*/*/*.a
      - dynare++/integ/src/quadrature-points
Sébastien Villemot's avatar
Sébastien Villemot committed
48
      - dynare++/src/dynare++
Sébastien Villemot's avatar
Sébastien Villemot committed
49
    expire_in: 1 week
Sébastien Villemot's avatar
Sébastien Villemot committed
50 51 52 53 54

build_doc:
  stage: build
  script:
    - autoreconf -si
55
    - ./configure --disable-matlab --disable-octave PACKAGE_VERSION=$VERSION PACKAGE_STRING="dynare $VERSION"
56
    - make -j $(nproc) pdf html
Sébastien Villemot's avatar
Sébastien Villemot committed
57 58
  artifacts:
    paths:
59
      - doc/manual/build/
60 61 62 63
      - doc/*.pdf
      - doc/*/*.pdf
      - dynare++/doc/*.pdf
      - preprocessor/doc/*/*.pdf
64
    expire_in: 1 week
65

66 67 68
pkg_source:
  stage: test_and_pkg
  script:
69
    - rm doc/manual/source/_static/mathjax && sed -i "/^mathjax_path *=/d" doc/manual/source/conf.py
70 71
    - 'for f in configure.ac preprocessor/configure.ac mex/build/matlab/configure.ac mex/build/octave/configure.ac; do sed -i "s/^AC_INIT(\[\(.*\)\],\s*\[\(.*\)\])/AC_INIT([\1], [$VERSION])/" $f; done'
    - autoreconf -si
72
    - ./configure --with-matlab=/usr/local/MATLAB/$MATLAB_VERSION MATLAB_VERSION=$MATLAB_VERSION
73 74 75 76 77
    - make dist
  artifacts:
    paths:
      - dynare-*.tar.xz
    expire_in: 1 week
78
  dependencies: []
79

80 81 82 83 84 85 86 87 88 89
pkg_windows:
  stage: test_and_pkg
  script:
    - ln -s ~/tarballs windows/deps/
    - make -C windows
  cache:
    key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
    paths:
      - windows/deps/sources64/
      - windows/deps/lib64/
90 91
      # We do not cache lib64-msys2, mingw64, octave64 and
      # matlab64, because those are simply extracted from a tarball. It
92
      # would be a waste of space and of (re-compression) time.
93 94 95
  artifacts:
    paths:
      - windows/exe/*
96
      - windows/7z/*
97 98 99 100 101
      - windows/zip/*
    expire_in: 1 week
  dependencies:
    - build_doc

102 103 104
pkg_macOS:
  stage: test_and_pkg
  script:
105
    - ln -s ~/tarballs macOS/deps/
106
    - make -C macOS
107 108 109 110 111
  cache:
    key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
    paths:
      - macOS/deps/sources64/
      - macOS/deps/lib64/
112 113 114 115 116 117 118 119 120
  tags:
    - macOS
  artifacts:
    paths:
      - macOS/pkg/*
    expire_in: 1 week
  dependencies:
    - build_doc

121
.test_matlab_template:
122
  stage: test_and_pkg
123 124 125 126 127 128
  artifacts:
    paths:
      - tests/*.m.log
      - tests/*.m.trs
      - tests/*/*.m.log
      - tests/*/*.m.trs
129
      - tests/*/*.jnl
130 131
      - tests/*/*/*.m.log
      - tests/*/*/*.m.trs
132
      - tests/*/*/*.jnl
Sébastien Villemot's avatar
Sébastien Villemot committed
133 134
      - tests/run_test_matlab_output.txt
    when: always
135 136 137
  dependencies:
    - build_binaries

138 139
test_matlab:
  extends: .test_matlab_template
140 141
  script:
    - autoreconf -si
142
    - ./configure --disable-octave --with-matlab=/usr/local/MATLAB/$MATLAB_VERSION MATLAB_VERSION=$MATLAB_VERSION
143 144 145
    - make -j $(($(nproc) * 3 / 4)) -C tests check-matlab

test_old_matlab:
146
  extends: .test_matlab_template
147 148
  script:
    - autoreconf -si
149
    - ./configure --disable-octave --with-matlab=/usr/local/MATLAB/$OLD_MATLAB_VERSION MATLAB_VERSION=$OLD_MATLAB_VERSION
150 151 152 153 154
    - make -C mex/build/matlab clean
    - make -j $(nproc) -C mex/build/matlab
    - make -j $(($(nproc) * 3 / 4)) -C tests check-matlab
  when: manual

155
test_octave:
156
  stage: test_and_pkg
157 158 159 160 161 162
  variables:
    OPENBLAS_NUM_THREADS: 1
  script:
    - autoreconf -si
    - ./configure --disable-matlab
    - make -j $(nproc) -C tests check-octave
163 164 165 166 167 168
  artifacts:
    paths:
      - tests/*.o.log
      - tests/*.o.trs
      - tests/*/*.o.log
      - tests/*/*.o.trs
169
      - tests/*/*.jnl
170 171
      - tests/*/*/*.o.log
      - tests/*/*/*.o.trs
172
      - tests/*/*/*.jnl
Sébastien Villemot's avatar
Sébastien Villemot committed
173 174
      - tests/run_test_octave_output.txt
    when: always
175 176
  dependencies:
    - build_binaries
Sébastien Villemot's avatar
Sébastien Villemot committed
177
  when: manual
178 179

test_dynare++:
180
  stage: test_and_pkg
181 182 183
  script:
    - autoreconf -si
    - ./configure --disable-matlab --disable-octave
184 185 186 187
    - touch dynare++/parser/cc/*_tab.cc dynare++/parser/cc/*_tab.hh dynare++/parser/cc/*_ll.cc dynare++/src/*_tab.cc dynare++/src/*_tab.hh dynare++/src/*_ll.cc
    - touch dynare++/*/*.o dynare++/*/*/*.o
    - touch dynare++/*/*.a dynare++/*/*/*.a
    - touch dynare++/integ/src/quadrature-points dynare++/src/dynare++
188 189 190
    - make -C dynare++ check
  dependencies:
    - build_binaries
191 192 193
  artifacts:
    paths:
      - dynare++/kord/out.txt
194 195 196 197
      - dynare++/tests/*.jnl
      - dynare++/tests/*.m
      - dynare++/tests/*.mat
      - dynare++/tests/*.dump
198 199 200

deploy_manual_unstable:
  stage: deploy
201 202 203 204
  rules:
    - if: '$CI_PROJECT_NAMESPACE == "Dynare" && $CI_COMMIT_REF_NAME == "master"'
      when: on_success
    - when: never
205
  tags:
206
    - restricted
207 208 209 210 211
  dependencies:
    - build_doc
  script:
    - rm -rf doc/manual/build/html/_static/mathjax
    - ln -s /usr/share/javascript/mathjax doc/manual/build/html/_static/mathjax
212
    - rsync --recursive --links --delete doc/manual/build/html/ /srv/www.dynare.org/manual-unstable/
213 214 215

deploy_snapshot_unstable:
  stage: deploy
216 217 218 219
  rules:
    - if: '$CI_PROJECT_NAMESPACE == "Dynare" && $CI_COMMIT_REF_NAME == "master"'
      when: on_success
    - when: never
220 221 222 223 224
  tags:
    - restricted
  dependencies:
    - pkg_source
    - pkg_windows
225
    - pkg_macOS
226
  script:
227
    - f=(windows/exe/*) && osslsigncode sign -pkcs12 ~/cepremap-comodo-sectigo-code-signing.p12 -n Dynare -i https://www.dynare.org -t http://timestamp.comodoca.com -in ${f[0]} -out ${f[0]}.signed && mv ${f[0]}.signed ${f[0]}
228
    - cp *.tar.xz /srv/www.dynare.org/snapshot/source/ && ln -sf *.tar.xz /srv/www.dynare.org/snapshot/source/dynare-latest-src.tar.xz
229
    - f=(windows/exe/*) && cp ${f[0]} /srv/www.dynare.org/snapshot/windows/ && ln -sf ${f[0]##*/} /srv/www.dynare.org/snapshot/windows/dynare-latest-win.exe
230
    - f=(windows/7z/*) && cp ${f[0]} /srv/www.dynare.org/snapshot/windows-7z/ && ln -sf ${f[0]##*/} /srv/www.dynare.org/snapshot/windows-7z/dynare-latest-win.7z
231
    - f=(windows/zip/*) && cp ${f[0]} /srv/www.dynare.org/snapshot/windows-zip/ && ln -sf ${f[0]##*/} /srv/www.dynare.org/snapshot/windows-zip/dynare-latest-win.zip
232
    - f=(macOS/pkg/*) && cp ${f[0]} /srv/www.dynare.org/snapshot/macos/ && ln -sf ${f[0]##*/} /srv/www.dynare.org/snapshot/macos/dynare-latest-macos.pkg
233
    - ~/update-snapshot-list.sh
234
    - curl -X POST -F token="$WEBSITE_PIPELINE_TRIGGER_TOKEN" -F ref=master https://git.dynare.org/api/v4/projects/40/trigger/pipeline