Fork me on GitHub

build-in-debian.bzed.at

Easily build and test your Debian packaging on travis-ci.org & GitHub

What is this?

build-in-debian.bzed.at is based on the code of the awesome travis.debian.net. Thanks to @lamby for it.

build-in-debian.bzed.at is a hosted service to be able to build and test your sources in a clean Debian environment, using the Travis CI continuous integration platform. Amongst many other advantages, this helps catch issues as early as possible and avoids having to run long package builds on one's own computers. Also it might make your Debian package maintainer happy to know that you take care of build failures in Debian.

Quick setup

  1. Enable builds for your package on travis-ci.org:
  2. Ensure "Only build if .travis.yml is present" is enabled:
  3. Add .travis.yml to your source code:
    $ wget -O.travis.yml http://build-in-debian.bzed.at/travis.yml
    $ git add .travis.yml
    $ git commit -m "Add .travis.yml from http://build-in-debian.bzed.at."
  4. Configure your build-dependencies and build scripts, either in
    .travis.yml
    or using the Travis CI web interface. You'll have to set the
    TRAVIS_DEBIAN_BUILD_DEPENDENCIES
    and
    TRAVIS_DEBIAN_BUILD_COMMAND
    environment variables.

How it works

At it's core build-in-debian.bzed.at is a hosted POSIX shell script that is executed within the Travis CI test environment.

A throwaway Docker image is created containing all the required build-dependencies. Your source is then built in this isolated environment with no access to the internet.

Configuration

Configuration is performed by setting environment variables. You can do this within the Travis CI web interface itself.

Please note that the API is currently unstable.

TRAVIS_DEBIAN_BUILD_DEPENDENCIES
Space seperated list of packages necessary to build your source code. Defaults to
build-essential
.
TRAVIS_DEBIAN_BUILD_COMMAND
Command which builds your source code. The return code decides about the success of the build.
TRAVIS_DEBIAN_DISTRIBUTION
Which distribution of Debian the package should be built in. By default, unstable will be used..
TRAVIS_DEBIAN_BACKPORTS
When true, the corresponding backports repository will be enabled in /etc/apt/sources.list. If TRAVIS_DEBIAN_DISTRIBUTION is not set, the value is automatically detected.
TRAVIS_DEBIAN_SECURITY_UPDATES
When true, the corresponding repository for security updates will be enabled in /etc/apt/sources.list. If not set, updates are automatically enabled for the distributions that have security support.
TRAVIS_DEBIAN_EXPERIMENTAL
When true, Debian's experimental repository will be enabled. If TRAVIS_DEBIAN_DISTRIBUTION is not set, the value is automatically detected.
TRAVIS_DEBIAN_MIRROR
Which Debian mirror to use. By default, ftp.de.debian.org is used.
TRAVIS_DEBIAN_EXTRA_REPOSITORY
If the package has some dependencies not found in Debian, you can add your own repository to the build using this variable. The format is the same as /etc/apt/sources.list, for example "https://my.repo.net/debian/ stretch main".
TRAVIS_DEBIAN_EXTRA_REPOSITORY_GPG_URL
Location of the public key of the extra repository defined in TRAVIS_DEBIAN_EXTRA_REPOSITORY, so that its packages can be authenticated.
TRAVIS_DEBIAN_TARGET_DIR
Which directory to store the results of the build. By default, the packages are stored in the parent directory.
TRAVIS_DEBIAN_BUILD_DIR
Which directory to build under. By default, /tmp/buildd is used.
TRAVIS_DEBIAN_NETWORK_ENABLED
By default, the network is disabled during the build process. If your build really needs internet access, set this value to true.
TRAVIS_DEBIAN_BUILD_ENVIRONMENT
Extra environment for the build process within the docker container. For example use CC=clang.

Frequently asked questions (FAQ)

Q: But wget | sh - is insecure!
A: Of course, and you should never run such a command on your own machine. However, not only does Travis-CI build within throwaway containers that you are not responsible for, cannot trust, and generally don't care about, there is zero expectation that the resulting .deb files are to be used or installed anywhere.

Copyright

Copyright © 2017 Bernd Zeimetz <bernd@bzed.de>

Copyright © 2015, 2016 Chris Lamb <lamby@debian.org>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.