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 4 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 @@
# _____ _ _
# | __|___ ___ ___ _| |___ _____| |_ ___ ___ ___
# | __| _| -_| -_| . | . | | . | . | | -_|
# |__| |_| |___|___|___|___|_|_|_|___|___|_|_|___|
#
# Freedom in the Cloud
#
# Gitlab-CI: Build and Test to ensure that known bugs get caught
#
# License
# =======
#
# Copyright (C) 2019 Liam Hurwitz <liam@contra-bit.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This file builds images for freedombone and tests various apps
# see https://docs.gitlab.com/ce/ci/yaml/README.html for all available options
#
# 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.
# TODO: Currently erverything is run as root
#
# Local Testing is sometimes more Verbose. To run locally make sure you have gitlab-runner and docker installed,
# then run gitlab-runner exec docker [testname]
image: gitlab.informatik.uni-bremen.de:5005/turingcomplete/freedombone:latest

stages:
- build
- test
- deploy
build amd64:
stage: build
script:
- echo "Buidling Image for amd64"
- freedombone-image -t amd64 -m http://www.fb3.uni-bremen.de/download/linux/debian/debian/

artifacts:
paths:
- freedombone-main-all-amd64.img
only:
- tags

build qemu64:
stage: build
script:
- echo "Buidling Image for qemu-x86_64"
- freedombone-image -t qemu-x86_64 -m http://www.fb3.uni-bremen.de/download/linux/debian/debian/

artifacts:
paths:
- freedombone-main-all-qemu-x86_64.img
only:
- tags

build beaglebonegreen:
stage: build
script:
- echo "Buidling Image for beaglebonegreen"
- freedombone-image -t beaglebonegreen -m http://www.fb3.uni-bremen.de/download/linux/debian/debian/

artifacts:
paths:
- freedombone-main-all-beaglebonegreen.img
only:
- tags

build beaglebonegreenmesh:
stage: build
script:
- echo "Buidling Image for beaglebonegreen"
- freedombone-image -t beaglebonegreen -m http://www.fb3.uni-bremen.de/download/linux/debian/debian/ -v mesh

artifacts:
paths:
- freedombone-main-all-beaglebonegreen.img
only:
- tags

build amd64meshclient:
stage: build
script:
- echo "Buidling Image for amd64 meshclient"
- freedombone-image -t amd64 -m http://www.fb3.uni-bremen.de/download/linux/debian/debian/ -v meshclient

artifacts:
paths:
- freedombone-main-all-beaglebonegreen.img
only:
- tags

build menuconfig-onion:
stage: build
script:
# Install Freedombone to local testing for testing
# TODO: make sure,that tests have access to this build
# TODO: add headless menuconfig
- export TERMINFO=/usr/lib/terminfo
- echo $TERMINFO
- sudo freedombone menuconfig-onion

build menuconfig:
stage: build
script:
- export TERMINFO=/usr/lib/terminfo
- echo $TERMINFO
- sudo freedombone menuconfig

test syncthing:
stage: test
script:
# TODO: Emualte User in Browser for Clicks in postinstall with python programm
# Then scrape HTML in order to use assertions to check if app works
- echo "Testing Install for Syncthing"
- freedombone addremove add syncthing
- echo "For example run a test suite"
- freedombone addremove remove syncthing
test2:
stage: test
script:
- echo "Do another parallel test here"
- echo "For example run a lint test"
deploy1:
stage: deploy
script:
# TODO: Decide where to host images, and then push artefacts to website
# Hosting at Uni Bremen should be no problem. TODO: Ask about logging
- echo "Do your deploy here"

+ 66
- 0
Dockerfile View File

@@ -0,0 +1,66 @@
# _____ _ _
# | __|___ ___ ___ _| |___ _____| |_ ___ ___ ___
# | __| _| -_| -_| . | . | | . | . | | -_|
# |__| |_| |___|___|___|___|_|_|_|___|___|_|_|___|
#
# Freedom in the Cloud
#
# Dockerfile for Gitlab Runner. Save Electricity and Time by saving build time
#
# License
# =======
#
# Copyright (C) 2019 Liam Hurwitz <liam@contra-bit.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Set the base image to debian

FROM debian:stretch

# File Author / Maintainer
MAINTAINER Liam Hurwitz

################## BEGIN INSTALLATION ######################

# Update the repository sources list
RUN apt-get update && \
apt-get -y install sudo

# TODO: How to sudo without tty or askpass
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
##
## Install Essental Build Tools
##
RUN apt-get install git build-essential dialog openssh-client -y


##
## Install Freedombone Tools
##
RUN git clone https://gitlab.informatik.uni-bremen.de/turingcomplete/freedombone.git
RUN cd freedombone &&\
git checkout stretch &&\
make install

##
## Install Packages for building images
##
RUN echo "Reached Build \nInstalling Packages" &&\
sudo freedombone-image --setup debian

# Export Terminfo so tput can be executed
RUN export TERMINFO=/usr/lib/terminfo

USER root
CMD /bin/bash

Loading…
Cancel
Save