1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00
VILLASnode/.gitlab-ci.yml
2017-05-14 10:50:36 +02:00

179 lines
4 KiB
YAML

variables:
GIT_STRATEGY: fetch
GIT_SUBMODULE_STRATEGY: recursive
PREFIX: /usr/
RSYNC_OPTS: --recursive --ignore-missing-args --chown $DEPLOY_USER:$DEPLOY_USER
DOCKER_IMAGE_DEV: villas/node-dev:${CI_COMMIT_REF_NAME}
stages:
- prepare
- build
- test
- deploy
# For some reason, GitLab CI prunes the contents of the submodules so we need to restore them.
before_script:
- git submodule foreach git checkout .
# Stage: prepare
##############################################################################
# Build docker image which is used to build & test VILLASnode
docker-dev:
stage: prepare
before_script:
# - docker login -u $DOCKER_USER -p $DOCKER_PASS -e $DOCKER_EMAIL $DOCKER_REGISTRY
script:
- make docker-dev
tags:
- shell
- linux
# Stage: build
##############################################################################
build:
stage: build
script:
- make
artifacts:
name: "${CI_PROJECT_NAME}-${CI_BUILD_REF}"
paths:
- build/release/
image: $DOCKER_IMAGE_DEV
tags:
- docker
docs:
stage: build
artifacts:
name: "${CI_PROJECT_NAME}-doc-${CI_BUILD_REF}"
paths:
- build/release/doc/
script:
- make doc
image: $DOCKER_IMAGE_DEV
tags:
- docker
packages:
stage: build
before_script:
- dnf -y config-manager --add-repo https://$DEPLOY_USER:$DEPLOY_PASS@$DEPLOY_HOST/packages/villas.repo
- dnf -y --refresh install libwebsockets-devel libxil-devel
script:
- make rpm-villas-node
only:
- tags
- triggers
artifacts:
name: "${CI_PROJECT_NAME}-packages-${CI_BUILD_REF}"
paths:
- build/release/packaging/*.tar.gz
- build/release/packaging/rpm/RPMS/
image: $DOCKER_IMAGE_DEV
tags:
- docker
# Stage: test
##############################################################################
coverage:
stage: test
script:
- make coverage COVERAGE=1
artifacts:
name: "${CI_PROJECT_NAME}-coverage-${CI_BUILD_REF}"
paths:
- build/release-coverage/coverage/
- build/release-coverage/coverage.txt
- build/release-coverage/coverage.xml
image: $DOCKER_IMAGE_DEV
coverage: '/lines: (\d+\.\d+\%)/'
tags:
- docker
unit:
stage: test
dependencies:
- build
script:
- make run-unit-tests
image: $DOCKER_IMAGE_DEV
tags:
- docker
integration:
stage: test
dependencies:
- build
script:
- make run-integration-tests
artifacts:
name: "${CI_PROJECT_NAME}-integration-tests-${CI_BUILD_REF}"
when: always
paths:
- build/release/tests/integration/
image: $DOCKER_IMAGE_DEV
tags:
- docker
# Stage: deliver
##############################################################################
docker:
stage: deploy
before_script:
# - docker login -u $DOCKER_USER -p $DOCKER_PASS -e $DOCKER_EMAIL $DOCKER_REGISTRY
script:
- make docker
- make deploy-docker
dependencies:
- packages
only:
- tags
tags:
- shell
- linux
website:
stage: deploy
script:
- rsync -r web/ $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/
only:
- develop
tags:
- villas-deploy
deliver-web:
stage: deploy
script:
- ssh $DEPLOY_USER@$DEPLOY_HOST mkdir -p $DEPLOY_PATH/{coverage,doc}/$CI_BUILD_REF_NAME/
- rsync $RSYNC_OPTS build/release-coverage/coverage/ $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/coverage/$CI_BUILD_REF_NAME/
- rsync $RSYNC_OPTS build/release/doc/html/ $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/doc/$CI_BUILD_REF_NAME/
dependencies:
- docs
- coverage
- packages
only:
- develop
- master
tags:
- villas-deploy
deliver-packages:
stage: deploy
script:
- ssh $DEPLOY_USER@$DEPLOY_HOST mkdir -p $DEPLOY_PATH/{dist,../packages}
- rsync $RSYNC_OPTS build/release/packaging/rpm/RPMS/ $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/../packages/
- rsync $RSYNC_OPTS build/release/packaging/*.tar.gz $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/dist/
- ssh $DEPLOY_USER@$DEPLOY_HOST createrepo $DEPLOY_PATH/../packages
dependencies:
- packages
only:
- tags
tags:
- villas-deploy