Skip to content

Commit 832e6d2

Browse files
committed
Build and E2E Test implemented for CircleCi environment
Signed-off-by: Marcel Wagner <[email protected]>
1 parent f3f144c commit 832e6d2

File tree

2 files changed

+139
-24
lines changed

2 files changed

+139
-24
lines changed

.circleci/config.yml

+138-23
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,92 @@
22
#
33
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
44
#
5-
version: 2
6-
jobs:
7-
build:
8-
docker:
9-
# specify the version you desire here
10-
- image: circleci/node:8.0
11-
12-
# Specify service dependencies here if necessary
13-
# CircleCI maintains a library of pre-built images
14-
# documented at https://circleci.com/docs/2.0/circleci-images/
15-
# - image: circleci/mongo:3.4.4
16-
5+
version: 2.1
6+
executors:
7+
my-executor:
8+
machine:
9+
enabled: true
10+
image: ubuntu-1604:201903-01
1711
working_directory: ~/repo
1812
environment:
1913
shell: /bin/bash
2014
TERM: xterm
21-
15+
TZ: "Europe/Berlin"
16+
commands:
17+
setup-build-environment:
18+
description: "Setup build Environment"
19+
steps:
20+
- run:
21+
shell: /bin/bash
22+
name: Setup build environment
23+
command: |
24+
cd platform-setup
25+
sudo ./setup-ubuntu16.04.sh
26+
setup-branch:
27+
description: "Setup branch"
28+
steps:
29+
- run:
30+
shell: /bin/bash
31+
name: Setup branch
32+
command: |
33+
sudo apt install jq
34+
# First find out Base Branch (if any)
35+
if [ ! -z "${CIRCLE_PULL_REQUEST}" ]; then
36+
PR=${CIRCLE_PR_NUMBER}
37+
PR_REPO=${CIRCLE_PR_REPONAME}
38+
PROJECT_USERNAME=${CIRCLE_PROJECT_USERNAME}
39+
url="https://api.github.com/repos/${PROJECT_USERNAME}/${PR_REPO}/pulls/${PR}"
40+
BASE_BRANCH=$(curl "$url" | jq '.base.ref' | tr -d '"')
41+
echo Detected Pull Request with Base Branch ${BASE_BRANCH}
42+
fi
43+
git submodule init
44+
git submodule update
45+
if [ "$CIRCLE_BRANCH" = "develop" ] || [ "${BASE_BRANCH}" = "develop" ]; then
46+
#If on develop or a PR towards develop assume that all submodules are updated
47+
make update
48+
fi
49+
build-branch:
50+
description: "Build branch"
51+
steps:
52+
- run:
53+
shell: /bin/bash
54+
name: Build branch
55+
command: |
56+
yes| make build
57+
e2e-test:
58+
description: "E2E test"
59+
steps:
60+
- run:
61+
shell: /bin/bash
62+
name: E2e Test
63+
command: |
64+
yes| make test
65+
push-images:
66+
description: "Push images"
67+
parameters:
68+
tag:
69+
type: string
70+
default: "latest"
71+
steps:
72+
- run:
73+
shell: /bin/bash
74+
name: Push images to docker hub
75+
command: |
76+
docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}
77+
DOCKER_TAG="latest"
78+
if [ "<< parameters.tag >>" = "date" ]; then
79+
DOCKER_TAG=`date -I`
80+
fi
81+
if [ "<< parameters.tag >>" = "tag" ]; then
82+
DOCKER_TAG=`git describe --tag` || exit 1
83+
fi
84+
echo Now trying to push with Tag ${DOCKER_TAG}
85+
make push
86+
check-signed:
87+
description: "Check whether latest commit is signed"
2288
steps:
23-
- checkout
24-
2589
- run:
26-
name: Check whether most recent commit is signedoff
90+
name: Check whether most recent commit is signed
2791
shell: /bin/bash
2892
command: |
2993
MESSAGE=`git log -1 --pretty=%B`
@@ -34,10 +98,61 @@ jobs:
3498
echo "Commit is not signedoff"
3599
exit 1
36100
fi
37-
38-
# run tests!
39-
- run:
40-
shell: /bin/bash
41-
name: Run remote build & e2e tests
42-
command: |
43-
ssh -o "StrictHostKeyChecking no" [email protected] /opt/test/testTest.sh test
101+
jobs:
102+
build:
103+
executor: my-executor
104+
steps:
105+
- checkout
106+
- check-signed
107+
- setup-build-environment
108+
- setup-branch
109+
- build-branch
110+
- e2e-test
111+
build-master:
112+
executor: my-executor
113+
steps:
114+
- checkout
115+
- setup-build-environment
116+
- setup-branch
117+
- build-branch
118+
- e2e-test
119+
- push-images:
120+
tag: "tag"
121+
build-nightly:
122+
executor: my-executor
123+
steps:
124+
- checkout
125+
- setup-build-environment
126+
- setup-branch
127+
- build-branch
128+
- e2e-test
129+
- push-images:
130+
tag: "date"
131+
workflows:
132+
version: 2.1
133+
workflow:
134+
jobs:
135+
- build:
136+
filters:
137+
branches:
138+
ignore:
139+
- master
140+
- build-master:
141+
filters:
142+
branches:
143+
only:
144+
- master
145+
nightly:
146+
triggers:
147+
- schedule:
148+
cron: "0 0 * * *"
149+
filters:
150+
branches:
151+
only:
152+
- develop
153+
jobs:
154+
- build-nightly:
155+
filters:
156+
branches:
157+
only:
158+
- develop

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ stop:
194194
##
195195
update: distclean
196196
@$(call msg,"Git Update (dev only)");
197-
@git pull
197+
#@git pull
198198
@if [ -f setup-environment.sh ]; then \
199199
mv setup-environment.sh config-backup/setup-environment-$$(date +%Y-%m-%d-%H%M%S).sh.bak; \
200200
fi;

0 commit comments

Comments
 (0)