Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.

Commit 733501f

Browse files
wagmarceljelyoussefi
authored andcommitted
Build and E2E Test implemented for CircleCi environment
Signed-off-by: Marcel Wagner <[email protected]>
1 parent 60573c2 commit 733501f

File tree

2 files changed

+140
-24
lines changed

2 files changed

+140
-24
lines changed

.circleci/config.yml

Lines changed: 139 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,93 @@
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+
echo Detected that PR is related to develop. Will update all subrepos.
48+
make update
49+
fi
50+
build-branch:
51+
description: "Build branch"
52+
steps:
53+
- run:
54+
shell: /bin/bash
55+
name: Build branch
56+
command: |
57+
yes| make build
58+
e2e-test:
59+
description: "E2E test"
60+
steps:
61+
- run:
62+
shell: /bin/bash
63+
name: E2e Test
64+
command: |
65+
yes| make test
66+
push-images:
67+
description: "Push images"
68+
parameters:
69+
tag:
70+
type: string
71+
default: "latest"
72+
steps:
73+
- run:
74+
shell: /bin/bash
75+
name: Push images to docker hub
76+
command: |
77+
docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}
78+
DOCKER_TAG="latest"
79+
if [ "<< parameters.tag >>" = "date" ]; then
80+
DOCKER_TAG=`date -I`
81+
fi
82+
if [ "<< parameters.tag >>" = "tag" ]; then
83+
DOCKER_TAG=`git describe --tag` || exit 1
84+
fi
85+
echo Now trying to push with Tag ${DOCKER_TAG}
86+
make push
87+
check-signed:
88+
description: "Check whether latest commit is signed"
2289
steps:
23-
- checkout
24-
2590
- run:
26-
name: Check whether most recent commit is signedoff
91+
name: Check whether most recent commit is signed
2792
shell: /bin/bash
2893
command: |
2994
MESSAGE=`git log -1 --pretty=%B`
@@ -34,10 +99,61 @@ jobs:
3499
echo "Commit is not signedoff"
35100
exit 1
36101
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
102+
jobs:
103+
build:
104+
executor: my-executor
105+
steps:
106+
- checkout
107+
- check-signed
108+
- setup-build-environment
109+
- setup-branch
110+
- build-branch
111+
- e2e-test
112+
build-master:
113+
executor: my-executor
114+
steps:
115+
- checkout
116+
- setup-build-environment
117+
- setup-branch
118+
- build-branch
119+
- e2e-test
120+
- push-images:
121+
tag: "tag"
122+
build-nightly:
123+
executor: my-executor
124+
steps:
125+
- checkout
126+
- setup-build-environment
127+
- setup-branch
128+
- build-branch
129+
- e2e-test
130+
- push-images:
131+
tag: "date"
132+
workflows:
133+
version: 2.1
134+
workflow:
135+
jobs:
136+
- build:
137+
filters:
138+
branches:
139+
ignore:
140+
- master
141+
- build-master:
142+
filters:
143+
branches:
144+
only:
145+
- master
146+
nightly:
147+
triggers:
148+
- schedule:
149+
cron: "0 0 * * *"
150+
filters:
151+
branches:
152+
only:
153+
- develop
154+
jobs:
155+
- build-nightly:
156+
filters:
157+
branches:
158+
only:
159+
- develop

Makefile

Lines changed: 1 addition & 1 deletion
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)