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

180 lines
4 KiB
YAML
Raw Permalink Normal View History

2016-09-07 06:23:47 +02:00
variables:
2017-04-27 09:33:53 +02:00
GIT_STRATEGY: fetch
GIT_SUBMODULE_STRATEGY: recursive
PREFIX: /usr/
RSYNC_OPTS: --recursive --ignore-missing-args --chown $DEPLOY_USER:$DEPLOY_USER
2017-05-14 10:43:31 +02:00
DOCKER_IMAGE_DEV: villas/node-dev:${CI_COMMIT_REF_NAME}
2016-09-07 06:23:47 +02:00
stages:
- prepare
- build
- test
2016-09-07 06:23:47 +02:00
- deploy
2017-05-01 16:57:30 +02:00
# 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
##############################################################################
2016-09-07 06:23:47 +02:00
# Build docker image which is used to build & test VILLASnode
docker-dev:
2016-09-07 06:23:47 +02:00
stage: prepare
before_script:
2017-04-27 09:33:53 +02:00
# - docker login -u $DOCKER_USER -p $DOCKER_PASS -e $DOCKER_EMAIL $DOCKER_REGISTRY
2016-09-07 06:23:47 +02:00
script:
2017-04-27 09:33:53 +02:00
- make docker-dev
2016-10-14 01:08:57 -04:00
tags:
- shell
- linux
2016-09-07 06:23:47 +02:00
# Stage: build
##############################################################################
2016-09-07 06:23:47 +02:00
build:
stage: build
script:
- make
2016-09-07 06:23:47 +02:00
artifacts:
name: "${CI_PROJECT_NAME}-${CI_BUILD_REF}"
paths:
2017-03-31 21:20:36 +02:00
- build/release/
2017-05-14 10:43:31 +02:00
image: $DOCKER_IMAGE_DEV
2016-10-14 01:08:57 -04:00
tags:
- docker
2016-09-09 23:54:00 -04:00
2016-09-07 06:23:47 +02:00
docs:
stage: build
artifacts:
name: "${CI_PROJECT_NAME}-doc-${CI_BUILD_REF}"
paths:
2017-03-31 21:20:36 +02:00
- build/release/doc/
2016-09-07 06:23:47 +02:00
script:
- make doc
2017-05-14 10:43:31 +02:00
image: $DOCKER_IMAGE_DEV
2016-10-14 01:08:57 -04:00
tags:
- docker
packages:
stage: build
before_script:
2017-04-02 00:17:18 +02:00
- 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:
2017-04-02 00:17:18 +02:00
- make rpm-villas-node
only:
- tags
- triggers
artifacts:
name: "${CI_PROJECT_NAME}-packages-${CI_BUILD_REF}"
paths:
2017-03-31 21:20:36 +02:00
- build/release/packaging/*.tar.gz
- build/release/packaging/rpm/RPMS/
2017-05-14 10:43:31 +02:00
image: $DOCKER_IMAGE_DEV
tags:
- docker
2016-09-07 06:23:47 +02:00
# Stage: test
##############################################################################
2016-10-14 01:33:07 -04:00
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
2017-05-14 10:43:31 +02:00
image: $DOCKER_IMAGE_DEV
2017-04-02 00:17:18 +02:00
coverage: '/lines: (\d+\.\d+\%)/'
2016-10-14 01:33:07 -04:00
tags:
- docker
unit:
stage: test
2016-10-14 01:33:07 -04:00
dependencies:
- build
script:
- make run-unit-tests
2017-05-14 10:43:31 +02:00
image: $DOCKER_IMAGE_DEV
2016-10-14 01:08:57 -04:00
tags:
- docker
integration:
stage: test
dependencies:
- build
script:
- make run-integration-tests
artifacts:
name: "${CI_PROJECT_NAME}-integration-tests-${CI_BUILD_REF}"
2017-03-31 21:20:36 +02:00
when: always
paths:
2017-03-31 21:20:36 +02:00
- build/release/tests/integration/
2017-05-14 10:43:31 +02:00
image: $DOCKER_IMAGE_DEV
2016-10-14 01:08:57 -04:00
tags:
- docker
# Stage: deliver
##############################################################################
2016-09-07 06:23:47 +02:00
docker:
stage: deploy
2017-04-27 09:33:53 +02:00
before_script:
# - docker login -u $DOCKER_USER -p $DOCKER_PASS -e $DOCKER_EMAIL $DOCKER_REGISTRY
script:
- make docker
2017-04-27 09:33:53 +02:00
- make deploy-docker
dependencies:
2017-04-02 02:37:11 +02:00
- packages
only:
2017-04-02 00:17:18 +02:00
- tags
tags:
- shell
- linux
2017-03-31 21:20:36 +02:00
website:
stage: deploy
script:
- rsync -r web/ $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/
only:
- develop
tags:
- villas-deploy
deliver-web:
2016-10-15 22:52:31 -04:00
stage: deploy
script:
2017-04-18 01:48:40 +02:00
- 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/
2017-04-02 02:37:11 +02:00
dependencies:
- docs
- coverage
- packages
only:
- develop
- master
2017-04-02 02:37:11 +02:00
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/
2017-03-31 21:20:36 +02:00
- ssh $DEPLOY_USER@$DEPLOY_HOST createrepo $DEPLOY_PATH/../packages
2016-09-07 06:23:47 +02:00
dependencies:
2017-04-02 02:37:11 +02:00
- packages
only:
- tags
2016-10-14 01:08:57 -04:00
tags:
2016-10-14 01:33:07 -04:00
- villas-deploy