Browse Source

Add Gitlab-CI

Dockerfile for Gitlab Runner. Save Electricity and Time by saving build time
Gitlab-CI: Build and Test to ensure that known bugs get caught
pull/3/head
liam 2 months ago
parent
commit
7352024f9b
2 changed files with 209 additions and 0 deletions
  1. 143
    0
      .gitlab-ci.yml
  2. 66
    0
      Dockerfile

+ 143
- 0
.gitlab-ci.yml View File

@@ -0,0 +1,143 @@
1
+#  _____               _           _
2
+# |   __|___ ___ ___ _| |___ _____| |_ ___ ___ ___
3
+# |   __|  _| -_| -_| . | . |     | . | . |   | -_|
4
+# |__|  |_| |___|___|___|___|_|_|_|___|___|_|_|___|
5
+#
6
+#                              Freedom in the Cloud
7
+#
8
+# Gitlab-CI: Build and Test to ensure that known bugs get caught
9
+#
10
+# License
11
+# =======
12
+#
13
+# Copyright (C) 2019 Liam Hurwitz <liam@contra-bit.com>
14
+#
15
+# This program is free software: you can redistribute it and/or modify
16
+# it under the terms of the GNU Affero General Public License as published by
17
+# the Free Software Foundation, either version 3 of the License, or
18
+# (at your option) any later version.
19
+#
20
+# This program is distributed in the hope that it will be useful,
21
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
+# GNU Affero General Public License for more details.
24
+#
25
+# You should have received a copy of the GNU Affero General Public License
26
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
27
+#
28
+# This file builds images for freedombone and tests various apps
29
+# see https://docs.gitlab.com/ce/ci/yaml/README.html for all available options
30
+#
31
+# The Freedombone Docker image is defined in the Dockerfile, its purpose is to build and test freedombone. Using a docker image has the advantage, that most overhead is removed from the setup phase.
32
+# TODO: Currently erverything is run as root 
33
+#
34
+# Local Testing is sometimes more Verbose. To run locally make sure you have gitlab-runner and docker installed,
35
+# then run gitlab-runner exec docker [testname]
36
+image: gitlab.informatik.uni-bremen.de:5005/turingcomplete/freedombone:latest
37
+
38
+stages:
39
+  - build
40
+  - test
41
+  - deploy
42
+   
43
+build amd64:
44
+  stage: build
45
+  script:
46
+    - echo "Buidling Image for amd64"
47
+    - freedombone-image -t amd64 -m http://www.fb3.uni-bremen.de/download/linux/debian/debian/
48
+
49
+  artifacts:
50
+    paths:
51
+      - freedombone-main-all-amd64.img
52
+  only:
53
+    - tags
54
+  
55
+
56
+build qemu64:
57
+  stage: build
58
+  script:
59
+    - echo "Buidling Image for qemu-x86_64"
60
+    - freedombone-image -t qemu-x86_64 -m http://www.fb3.uni-bremen.de/download/linux/debian/debian/
61
+
62
+  artifacts:
63
+    paths:
64
+      - freedombone-main-all-qemu-x86_64.img
65
+  only:
66
+    - tags
67
+
68
+build beaglebonegreen:
69
+  stage: build
70
+  script:
71
+    - echo "Buidling Image for beaglebonegreen"
72
+    - freedombone-image -t beaglebonegreen -m http://www.fb3.uni-bremen.de/download/linux/debian/debian/
73
+
74
+  artifacts:
75
+    paths:
76
+      - freedombone-main-all-beaglebonegreen.img
77
+  only:
78
+    - tags
79
+
80
+build beaglebonegreenmesh:
81
+  stage: build
82
+  script:
83
+    - echo "Buidling Image for beaglebonegreen"
84
+    - freedombone-image -t beaglebonegreen -m http://www.fb3.uni-bremen.de/download/linux/debian/debian/ -v mesh
85
+
86
+  artifacts:
87
+    paths:
88
+      - freedombone-main-all-beaglebonegreen.img
89
+  only:
90
+    - tags
91
+   
92
+
93
+build amd64meshclient:
94
+  stage: build
95
+  script:
96
+    - echo "Buidling Image for amd64 meshclient"
97
+    - freedombone-image -t amd64 -m http://www.fb3.uni-bremen.de/download/linux/debian/debian/ -v meshclient
98
+
99
+  artifacts:
100
+    paths:
101
+      - freedombone-main-all-beaglebonegreen.img
102
+  only:
103
+    - tags
104
+
105
+build menuconfig-onion:
106
+  stage: build
107
+  script:
108
+  # Install Freedombone to local testing for testing
109
+  # TODO: make sure,that tests have access to this build
110
+  # TODO: add headless menuconfig
111
+    - export TERMINFO=/usr/lib/terminfo
112
+    - echo $TERMINFO
113
+    - sudo freedombone menuconfig-onion
114
+
115
+build menuconfig:
116
+  stage: build
117
+  script:
118
+    - export TERMINFO=/usr/lib/terminfo
119
+    - echo $TERMINFO
120
+    - sudo freedombone menuconfig
121
+
122
+test syncthing:
123
+  stage: test
124
+  script: 
125
+  # TODO: Emualte User in Browser for Clicks in postinstall with python programm
126
+  # Then scrape HTML in order to use assertions to check if app works
127
+    - echo "Testing Install for Syncthing"
128
+    - freedombone addremove add syncthing
129
+    - echo "For example run a test suite"
130
+    - freedombone addremove remove syncthing
131
+   
132
+test2:
133
+  stage: test
134
+  script: 
135
+    - echo "Do another parallel test here"
136
+    - echo "For example run a lint test"
137
+   
138
+deploy1:
139
+  stage: deploy
140
+  script:
141
+  # TODO: Decide where to host images, and then push artefacts to website
142
+  # Hosting at Uni Bremen should be no problem. TODO: Ask about logging
143
+    - echo "Do your deploy here"

+ 66
- 0
Dockerfile View File

@@ -0,0 +1,66 @@
1
+#  _____               _           _
2
+# |   __|___ ___ ___ _| |___ _____| |_ ___ ___ ___
3
+# |   __|  _| -_| -_| . | . |     | . | . |   | -_|
4
+# |__|  |_| |___|___|___|___|_|_|_|___|___|_|_|___|
5
+#
6
+#                              Freedom in the Cloud
7
+#
8
+# Dockerfile for Gitlab Runner. Save Electricity and Time by saving build time
9
+#
10
+# License
11
+# =======
12
+#
13
+# Copyright (C) 2019 Liam Hurwitz <liam@contra-bit.com>
14
+#
15
+# This program is free software: you can redistribute it and/or modify
16
+# it under the terms of the GNU Affero General Public License as published by
17
+# the Free Software Foundation, either version 3 of the License, or
18
+# (at your option) any later version.
19
+#
20
+# This program is distributed in the hope that it will be useful,
21
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
+# GNU Affero General Public License for more details.
24
+#
25
+# You should have received a copy of the GNU Affero General Public License
26
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
27
+# Set the base image to debian
28
+
29
+FROM debian:stretch
30
+
31
+# File Author / Maintainer
32
+MAINTAINER Liam Hurwitz
33
+
34
+################## BEGIN INSTALLATION ######################
35
+
36
+# Update the repository sources list
37
+RUN apt-get update && \
38
+      apt-get -y install sudo
39
+
40
+# TODO: How to sudo without tty or askpass
41
+RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
42
+##
43
+## Install Essental Build Tools
44
+##
45
+RUN apt-get install git build-essential dialog openssh-client -y
46
+
47
+
48
+##
49
+## Install Freedombone Tools
50
+##
51
+RUN git clone https://gitlab.informatik.uni-bremen.de/turingcomplete/freedombone.git
52
+RUN cd freedombone &&\
53
+        git checkout stretch &&\
54
+        make install
55
+
56
+##
57
+## Install Packages for building images
58
+##
59
+RUN echo "Reached Build \nInstalling Packages" &&\
60
+        sudo freedombone-image --setup debian
61
+
62
+# Export Terminfo so tput can be executed
63
+RUN export TERMINFO=/usr/lib/terminfo
64
+
65
+USER root
66
+CMD /bin/bash

Loading…
Cancel
Save