Skip to content
Snippets Groups Projects

Feature/#7 prologue

Merged Mathias Goebel requested to merge feature/#7-prologue into develop
5 files
+ 157
46
Compare changes
  • Side-by-side
  • Inline
Files
5
+ 39
30
stages:
- load
- preprocess
- process
- test
- deploy
before_script:
- source functions.sh
load:
image: docker.gitlab.gwdg.de/fontane-notizbuecher/build:latest
image: docker.gitlab.gwdg.de/mgoebel/swiss_knife/fedora:latest
stage: load
services:
- name: existdb/existdb:release
alias: exist
cache:
paths:
- data/*.xml
script:
- ./load.sh -e exist:8080 -f load.xq
- if [[ ! -d data/ ]]; then ./load.sh -e exist:8080 -f load.xq; fi
artifacts:
paths:
- load.txt
- list.txt
- data/
# when a git flow release is made, a tag will be pushed starting this job. it
# will keep the resulting artifact from job number one and it will set up a
# Gitlab release at the repo. therefore the merge message starting at the release
# branch should be written in markdown.
release:
stage: deploy
only:
- tags
replacements:
image: docker.gitlab.gwdg.de/mgoebel/swiss_knife/fedora:latest
stage: preprocess
script:
- cd data
# prologue
- sed --in-place --expression '1i<?xml version="1.0" encoding="UTF-8"?>' *.xml
- sed --in-place --expression '2i<?xml-stylesheet type="text/css" href="../css/tei.css"?>' *.xml
# fix TEI.2
- sed --in-place --expression 's*TEI.2*TEI*g' *.xml
# namespace (when missing)
- sed --in-place --expression 's*<TEI*<TEI xmlns="http://www.tei-c.org/ns/1.0"*g' $(grep --files-without-match "xmlns" *.xml)
# misspelled elemets
- sed --in-place --expression 's*SourceDesc*sourceDesc*g' *.xml
- cd ..
artifacts:
paths:
- data/
validation:
image: docker.gitlab.gwdg.de/mgoebel/swiss_knife/fedora:latest
stage: test
script:
# get number of first job in pipeline (assuming that this will create the needed artifact)
# it is also possible to query for a job name by altering the jq filter
- 'curl --output jobs.json --header "PRIVATE-TOKEN: $GITLAB_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs"'
- CI_JOB_TARGET=$(jq ".[0].id" < jobs.json)
- echo $CI_JOB_TARGET
# keep artifact (release will link there)
- 'curl --request POST --header "PRIVATE-TOKEN: $GITLAB_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/jobs/$CI_JOB_TARGET/artifacts/keep"'
# create release data
# parse commit message (markdown, lines starting with “\”)
- MARKDOWN=$(echo "$CI_COMMIT_MESSAGE" | sed 's=^\\==g')
# prepare the json file
- 'jq
".name = \"$CI_PROJECT_PATH $CI_COMMIT_TAG\" |
.tag_name = \"$CI_COMMIT_TAG\" |
.description = \"$MARKDOWN\" |
.assets.links[0].name = \"package\" |
.assets.links[0].url = \"https://gitlab.gwdg.de/$CI_PROJECT_PATH/-/jobs/$CI_JOB_TARGET/artifacts/download\"
" < .gitlab/gitlab-release.json.tmpl > gitlab-release.json'
- 'curl --header "Content-Type: application/json" --header "PRIVATE-TOKEN: $GITLAB_TOKEN" --data @gitlab-release.json --request POST $CI_API_V4_URL/projects/$CI_PROJECT_ID/releases'
- curl https://repo1.maven.org/maven2/com/thaiopensource/jing/20091111/jing-20091111.jar --output jing.jar
- curl https://tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng --output tei_all.rng
- java -jar jing.jar tei_all.rng tei/*.xml > validation-report.log || true
- grep "error" validation-report.log --count
artifacts:
paths:
- gitlab-release.json
\ No newline at end of file
- validation-report.log
when: always
Loading