Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TravisCI on Raspberry Pi

I'm currently working on a Raspberry Pi related project on github, and I would like to attach it to some kind of CI system so contributors can see if they break things without having to build circuits (the project involves GPIO pins). TravisCI seems to be the obvious choice as it integrates nicely with github, but I am open to others

After looking around, it seems that the thing to do would be to run a TravisCI server locally on my Pi machine (rather than try to set up some kind of emulated environment in the Travis cloud), however I'm not sure how I point the github project page at my local server? Can anyone explain how I do this?

like image 389
Madden Avatar asked Mar 13 '18 12:03

Madden


1 Answers

Is it necessary that you run the project on your personal hardware? If you can be satisfied by compiling the code for Raspberry Pi and testing you can do it the following way:

Compilation

Cross-compile on Travis. I got the following code worked out:

Dockerfile:

FROM mitchallen/pi-cross-compile

# Switch into our apps working directory
WORKDIR /build
COPY . /build

# The base image has more examples how to use make or CMake for the project, directly
# calling the cross-compiler, is the minimal example here.
RUN ["/pitools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc",\
  "-o", "hello", "hello.cpp"]

.travis.yml:

language: cpp

services:
  - docker

before_install:
  - docker build -t me/image .

script:
  # One of those lines is necessary otherwise travis runs 'rake' by default.
  - true
  - echo "Success"

hello.cpp:

#include <stdio.h>

int main (int argc, char **argv) {
    printf("Hello, world!\n");
    return 0;
}

Testing

Use Qemu on travis. Here is an example with this tool.

like image 91
Unapiedra Avatar answered Nov 02 '22 19:11

Unapiedra