Reputation: 1080
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?
Upvotes: 6
Views: 1621
Reputation: 4299
I have used fake-rpi
to test code on Travis CI with picamera
as dependency. Of course it won't be able to fake the actual camera, but non-hardware tests dependent on picamera
can be accomplished with fake-rpi
on Travis CI. I suppose fake-rpi
can also work with software-side tests on RPi.GPIO
.
Upvotes: 0
Reputation: 920
I'm not sure how I point the github project page at my local server? Can anyone explain how I do this?
This is a bit vague in scope so for now I'll have to point ya to some of the bits I've found helpful so far in figuring out something similar. I may update this with more details and less hand-waving when I've figured out the best course to plot for my own RPi related integrations with Travis CI.
Hint on GitHub notifying another server can be done via their webhooks API, which is how travis-ci.org
does/did it, where as travis-ci.com
now uses GitHub Apps (last I checked) to subscribe (could even be via some listed webhooks) to repository events.
The Travis CI ReadMe states...
#
travis-listenertravis-listener receives notifications from GitHub whenever commits are pushed or pull requests are opened. They are then pushed onto RabbitMQ for other apps to process.
...the project involves GPIO pins...
If you're going to be running code on an RPi in an automated fashion, I'll suggest that you preform some form of safe listing eg. commit signing public keys and/or user names; mitigate some of the shenanigans possible from rouge pull requests in other words.
Probably would be a good idea to get a good smoke detector, and design things to fail in an open state as much as possible too.
Upvotes: 0
Reputation: 16248
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:
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;
}
Use Qemu on travis. Here is an example with this tool.
Upvotes: 2