Drone.io is a Continuous Integration for Github and Bitbucket that monitors your code for bugs. It uses GitHub (or some other online service) to fetch repositories and Docker containers to run the build process.
It can be used as a service (free for public projects), or set up on a custom server for free.
On this page it is described how Drone was configured to build OpenWrt project hosted on GitHub.
Click the link and create a new application. In this example we are using:
Homepage URL: http://tango.drone.openwrt.ninja/ Authorization callback URL: http://tango.drone.openwrt.ninja/authorize
There you will get Client ID and Client Secret. You will use that in the next step.
On the host create the file /etc/drone/dronerc with the following content:
REMOTE_DRIVER=github REMOTE_CONFIG=https://github.com?client_id=<YOUR CLIENT ID>&client_secret=<YOUR CLIENT SECRET> DATABASE_DRIVER=sqlite3 DATABASE_CONFIG=/var/lib/drone/drone.sqlite
In this customized version the .drone.yml must be located on the path /var/lib/drone/.drone.yml. This path is now hard-coded. An example .drone.yml is given as follows:
build: image: "sartura/drone-openwrt-builder:arch" commands: - export FORCE_UNSAFE_CONFIGURE=1 - make defconfig - make -j8
Or to build with a customized configuration:
build: image: "owrt/drone-openwrt-builder:arch" commands: - export FORCE_UNSAFE_CONFIGURE=1 - make defconfig - wget 'https://raw.githubusercontent.com/openwrt-ninja/openwrt-configs/master/default-x86.config' -O .config - ./scripts/config/conf --alldefconfig Config.in - make -j8
We are hosting prebuilt Drone Docker images in Docker Hub using the owrt id. That said, if you have followed the above instructions and have Docker up and running this should bring up your own Drone instance:
docker run \\ --volume /var/lib/drone:/var/lib/drone \\ --volume /var/run/docker.sock:/var/run/docker.sock \\ --env-file /etc/drone/dronerc \\ --restart=always \\ --publish=80:8000 \\ --detach=true \\ --name=drone \\ owrt/drone:v42-static-recipe
Since OpenWrt builds take a while to complete make sure to increase Timeout in Minutes to a maximum value of 900 minutes.
At the moment only the defconfig is built. We should change it so every supported architecture is build tested with Drone CI.
In the Drone CI version 0.4.2 shows hardcoded string on GitHub builds ("continuous-integration/drone"). We are going to chage this so it is clearly visisible which drone build what and if it was sucessful.
When a pull request is made for a certain package we should build this minimal version of OpenWrt with the package in question and its dependencies. This can be done but additional scripting inside Drone CI system is needed.
Now, on every pull request everything is built from scratch. We should optimize the process so it does not build the entire toolchain every time and that we use a mirror close to the build servers to download all 3rd party sources.