abgabesystem/.gitlab-ci.yml
2018-09-21 12:22:40 +02:00

92 lines
1.8 KiB
YAML

image: $CI_REGISTRY/abgabesystem/docker-abgabesystem:latest
variables:
REFERENCE_SOLUTION: $CI_PROJECT_NAMESPACE/solutions/solutions
JPLAG_PATH: /app/jplag.jar
CI_REPO_HOST: $CI_REGISTRY
stages:
- test
- doc
- projects
- deadline
- plagiates
before_script:
## get ssh private key from secret variable
- echo "$SSH_PUBLIC_KEY" | tr -d '\r' > deploy_key.pub
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-add -l
- ssh-keyscan $CI_REPO_HOST | tee ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
## get API token from secret variable
- echo "\
[global]
default = default
ssl_verify = true
[default]
url = $(echo ${CI_PROJECT_URL} | cut -d '/' -f -3)
api_version = 4
private_token = ${PRIVATE_API_TOKEN}" > $HOME/.python-gitlab.cfg
- python3 setup.py install
deadlines:
## creates the pushed tag inside all projects
stage: deadline
tags:
- abgabesystem
script:
- abgabesystem deadline -t $CI_COMMIT_REF_NAME -r $REFERENCE_SOLUTION
only:
- tags
plagiates:
## creates checkout of the tag for all projects and runs plagiarism checker
stage: plagiates
tags:
- abgabesystem
script:
- mkdir -p results
- abgabesystem plagiates -t $CI_COMMIT_REF_NAME -r $REFERENCE_SOLUTION -j $JPLAG_PATH
artifacts:
paths:
- results/
only:
- tags
doc:
## creates html documentation
stage: doc
tags:
- abgabesystem
script:
- cd doc && make html
artifacts:
paths:
- doc/_build/html/
only:
- master
create_projects:
## create projects for all enrolled students
stage: projects
tags:
- abgabesystem
script:
- abgabesystem projects -c $CI_PROJECT_NAMESPACE -d deploy_key.pub
only:
- branches