Commit 88de3e26 authored by Sergey Goncharov's avatar Sergey Goncharov
Browse files

Merge branch 'master' of git8.cs.fau.de:inf8_staff/texcommon

parents 77889379 db03720a
compile_latex:
image: aergus/latex # the docker image by aergus https://hub.docker.com/r/aergus/latex/
stage: build
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
# if you need to upload PDFs somewhere else, add a private SSH key to the
# gitlab project config and then do the following:
#- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
#- 'which rsync || ( apt-get update -y && apt-get install rsync -y )'
#- mkdir -p ~/.ssh
#- eval $(ssh-agent -s)
#- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
#- ssh-add <(echo "$STAGING_PRIVATE_KEY")
script:
# the following script requires bash
# when editing, be careful, not to use any colons since they mess up the yaml parser!
# compile all the PDFs you are interested in:
- verb() { echo -e "\e[32;1m===== $* =====\e[0m" ; }
- failed=( )
- succeeded=( )
- compile_tex() { latexmk -f -cd -pdf "$1" ; }
# activate the following line if you use a custom makefile
#- compile_tex() { make "${1%%.tex}.pdf" ; }
- mapfile -t gitfiles < <(git ls-files)
- mapfile -d $'\0' -t texfiles < <(grep -lZ -d skip --include '*.tex' -E '^[^%]*\\documentclass' "${gitfiles[@]}")
- for t in "${texfiles[@]}" ; do verb "Compiling $t" ; compile_tex "$t" && succeeded+=( "$t" ) || failed+=( "$t" ) ; done
- git ls-files -z | xargs -0 rm -v -f # remove all tracked files such that they are not included in the artifacts
# if you want to upload PDFs somewhere else, do something like the following:
#- rsync -rvva *.pdf wissmann@faui8220:/serv/httpd/www8/htdocs/ext/thorsten/test
- echo "The following tex were compiled successfully:" ; printf "%s\n" "${succeeded[@]}"
- echo "The following tex files failed to build:" ; printf "%s\n" "${failed[@]}"
- echo "Successful Compilation Coverage $(((${#texfiles[@]}-${#failed[@]})*10000/${#texfiles[@]}))" | sed 's/..$/\.&/'
- if [ "${#failed[@]}" -ge 1 ] ; then verb "failed files $failed" ; false ; fi
# the second last line in the script prints the statistics which are parsed by the following regex:
coverage: /^Successful Compilation Coverage [0-9]*\.[0-9][0-9]/
cache:
untracked: true # cache all pdf files for subsequent runs
artifacts:
name: "${CI_PROJECT_NAME}-pdfs"
when: always
expire_in: 100 yrs
paths:
- ./*.pdf
- ./*/*.pdf
- ./*/*/*.pdf
- ./*/*/*/*.pdf
- ./*/*/*/*/*.pdf
- ./*/*/*/*/*/*.pdf
- ./*/*/*/*/*/*/*.pdf
- ./*/*/*/*/*/*/*/*.pdf
include:
- project: 'inf8_staff/texcommon'
file: '/gitlab-ci/latex.yml'
# You can link the most recently *finished* artifacts by a badge:
#
# Link: https://git8.cs.fau.de/%{project_path}/-/jobs/artifacts/%{default_branch}/browse?job=compile_latex
# Badge image URL: https://git8.cs.fau.de/%{project_path}/badges/%{default_branch}/build.svg
#
# e.g.: https://gitlab.cs.fau.de/thorsten/coalgpartref/-/jobs/artifacts/master/browse?job=compile_latex
# see also https://docs.gitlab.com/ee/user/project/pipelines/job_artifacts.html#downloading-the-latest-artifacts
#
#environment:
# name: Recent PDFs
# url: https://git8.cs.fau.de/$CI_PROJECT_PATH/builds/$CI_BUILD_ID/artifacts/browse
# Additionally, you can add a badge to your project page, indicating the build
# status and providing a link to the most recently *successfully* built artifacts:
# On the project page, go to: Settings → General → Badges (Expand) → Add Badge
# with the following data:
#
# Link: https://git8.cs.fau.de/%{project_path}/-/jobs/artifacts/%{default_branch}/browse?job=compile_latex
# Badge image URL: https://git8.cs.fau.de/%{project_path}/badges/%{default_branch}/build.svg
compile_latex:
image: aergus/latex # the docker image by aergus https://hub.docker.com/r/aergus/latex/
stage: build
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
# if you need to upload PDFs somewhere else, add a private SSH key to the
# gitlab project config and then do the following:
#- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
#- 'which rsync || ( apt-get update -y && apt-get install rsync -y )'
#- mkdir -p ~/.ssh
#- eval $(ssh-agent -s)
#- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
#- ssh-add <(echo "$STAGING_PRIVATE_KEY")
script:
# the following script requires bash
# when editing, be careful, not to use any colons since they mess up the yaml parser!
# compile all the PDFs you are interested in:
- verb() { echo -e "\e[32;1m===== $* =====\e[0m" ; }
- failed=( )
- succeeded=( )
- compile_tex() { latexmk -f -cd -pdf "$1" ; }
# activate the following line if you use a custom makefile
#- compile_tex() { make "${1%%.tex}.pdf" ; }
- mapfile -t gitfiles < <(git ls-files)
- mapfile -d $'\0' -t texfiles < <(grep -lZ -d skip --include '*.tex' -E '^[^%]*\\documentclass' "${gitfiles[@]}")
- for t in "${texfiles[@]}" ; do verb "Compiling $t" ; compile_tex "$t" && succeeded+=( "$t" ) || failed+=( "$t" ) ; done
- git ls-files -z | xargs -0 rm -v -f # remove all tracked files such that they are not included in the artifacts
# if you want to upload PDFs somewhere else, do something like the following:
#- rsync -rvva *.pdf wissmann@faui8220:/serv/httpd/www8/htdocs/ext/thorsten/test
- echo "The following tex were compiled successfully:" ; printf "%s\n" "${succeeded[@]}"
- echo "The following tex files failed to build:" ; printf "%s\n" "${failed[@]}"
- echo "Successful Compilation Coverage $(((${#texfiles[@]}-${#failed[@]})*10000/${#texfiles[@]}))" | sed 's/..$/\.&/'
- if [ "${#failed[@]}" -ge 1 ] ; then verb "failed files $failed" ; false ; fi
# the second last line in the script prints the statistics which are parsed by the following regex:
coverage: /^Successful Compilation Coverage [0-9]*\.[0-9][0-9]/
cache:
untracked: true # cache all pdf files for subsequent runs
artifacts:
name: "${CI_PROJECT_NAME}-pdfs"
when: always
expire_in: 100 yrs
paths:
- ./*.pdf
- ./*/*.pdf
- ./*/*/*.pdf
- ./*/*/*/*.pdf
- ./*/*/*/*/*.pdf
- ./*/*/*/*/*/*.pdf
- ./*/*/*/*/*/*/*.pdf
- ./*/*/*/*/*/*/*/*.pdf
# You can link the most recently *finished* artifacts by a badge:
#
# Link: https://git8.cs.fau.de/%{project_path}/-/jobs/artifacts/%{default_branch}/browse?job=compile_latex
# Badge image URL: https://git8.cs.fau.de/%{project_path}/badges/%{default_branch}/build.svg
#
# e.g.: https://git8.cs.fau.de/thorsten/coalgpartref/-/jobs/artifacts/master/browse?job=compile_latex
# see also https://docs.git8.com/ee/user/project/pipelines/job_artifacts.html#downloading-the-latest-artifacts
#
#environment:
# name: Recent PDFs
# url: https://git8.cs.fau.de/$CI_PROJECT_PATH/builds/$CI_BUILD_ID/artifacts/browse
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment