diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..cd1a56916 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,86 @@ +image: acs-public:5000/villas:latest + +variables: + # This registry is a linked docker container running on the same host + # and configured in gitlab-ci-runner config.toml as a linked service + DOCKER_REGISTRY: acs-public:5000 + DOCKER_IMAGE: villas:latest + +stages: + - prepare + - dependencies + - build + - deploy + +# Build docker image which is used to build & test VILLASnode +docker-image: + stage: prepare + image: stackbrew/docker:1.8.2 + before_script: + - docker info + script: + - docker build -t $DOCKER_REGISTRY/$DOCKER_IMAGE . + - docker push $DOCKER_REGISTRY/$DOCKER_IMAGE + +libwebsockets: + stage: dependencies + script: + - make -C thirdparty libwebsockets-2.0.2 + artifacts: + paths: + - thirdparty/libwebsockets-2.0.2/ + +libxil: + stage: dependencies + script: + - make -C thirdparty/xilinx + artifacts: + paths: + - thirdparty/xilinx/libxil.so + +build: + stage: build + variables: + PKG_CONFIG_PATH: /usr/local/lib/pkgconfig/ + before_script: + - make -C thirdparty/libwebsockets-2.0.2/build install + - make -C thirdparty/xilinx install + script: + - make + artifacts: + name: "${CI_PROJECT_NAME}-${CI_BUILD_REF}" + paths: + - libvillas.so + - fpga + - node + - pipe + - signal + - test + +docs: + stage: build + artifacts: + name: "${CI_PROJECT_NAME}-doc-${CI_BUILD_REF}" + paths: + - doc/html/ + script: + - make doc + +.ssh: &ssh + before_script: + - mkdir -p $HOME/.ssh + - echo -e "$SSH_SECRET_KEY" > $HOME/.ssh/id_rsa + - chmod 600 $HOME/.ssh/id_rsa + - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > $HOME/.ssh/config + - ssh-keyscan -H $DEPLOY_DOC_HOST >> $HOME/.ssh/known_hosts + +deploy-docs: + stage: deploy + <<: *ssh + script: + - scp -vpr doc/html/ $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/doc/$CI_BUILD_REF_NAME/ + only: + - develop + dependencies: + - docs + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3e5b467bf..000000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: c -compiler: gcc - -addons: - apt: - packages: - - zlib1g-dev - - libbind4-dev - - dia - - graphviz - - texlive-font-utils - -cache: - apt: true - directories: - - thirdparty - -install: - - if ! [ -d thirdparty/usr/ ]; then - make dependencies; - fi - -script: - - make build - -after_success: - - echo -e "Host ${DEPLOY_HOST}\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config - - make doc - - make deploy diff --git a/Dockerfile b/Dockerfile index b7931dbf0..1189c90ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ # # @copyright 2014-2015, Institute for Automation of Complex Power Systems, EONERC # This file is part of VILLASnode. All Rights Reserved. Proprietary and confidential. -# Unauthorized copying of this file, via any medium is strictly prohibited. +# Unauthorized copying of this file, via any medium is strictly prohibited. ################################################################################### FROM stv0g/dotfiles @@ -71,4 +71,4 @@ WORKDIR /villas # Compile #RUN make -C /villas -ENTRYPOINT /bin/bash \ No newline at end of file +ENTRYPOINT /bin/bash diff --git a/Makefile b/Makefile index e9e219ba5..d39a74220 100644 --- a/Makefile +++ b/Makefile @@ -22,8 +22,6 @@ PREFIX ?= /usr/local # Default debug level V ?= 2 -GIT_REV = $(shell git rev-parse --short HEAD) - # Compiler and linker flags LDLIBS = -pthread -lm -lvillas @@ -35,9 +33,15 @@ LIB_LDLIBS = -ldl -lrt CFLAGS += -std=c11 -Iinclude -Iinclude/villas -I. -MMD -mcx16 CFLAGS += -Wall -fdiagnostics-color=auto -CFLAGS += -D_GIT_REV='"$(GIT_REV)"' -D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE=1 -DV=$(V) +CFLAGS += -D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE=1 -DV=$(V) LDFLAGS += -pthread -L. -Wl,-rpath,'$$ORIGIN' +ifdef CI + CFLAGS += -D_GIT_REV='"${CI_BUILD_REF:0:7}~ci"' +else ifdef GIT + CFLAGS += -D_GIT_REV='"$(shell git rev-parse --short HEAD)"' +endif + # pkg-config dependencies PKGS = libconfig