BIOS - Simple GitHub Commit Statuses

You are invited to preview BIOS, a GitHub app that makes setting custom commit statuses easier and faster than ever.

Check out the BIOS GitHub app listing, install it for your org, add a bios.sh script to your repo, and enjoy fast automatic feedback on every code push to GitHub.

Commit Status

Commit Statuses

Commit statuses let you know if the code you push to GitHub meets conditions set for the repository you’re contributing to.

Commit statuses are an integral part of continuous integration (CI) and continuous delivery (CD), best practices for shipping software quickly and safely. In CI/CD, we rely on as much automation as possible to prevent deploying bad software.

Commit statuses are also important for maintaining code quality for a development team. More and more we can use tools that automatically analyze code and make sure it conforms to standards for language syntax, code formatting, and function comments before merging it into the master branch.

BIOS makes it easy to customize the rules a code base must follow to set a successful commit status.

Commit Statuses

bios.sh

BIOS is short for “Basic Input/Output System”.

With BIOS, the input is a bios.sh script you check into your repo that will run on every push to GitHub.

The primary output is a commit status – a success or failure – based on if the script ran successfully. Another output is a commit comment with the script logs.

This is similar to existing CI services like CircleCI, Jenkins or Travis CI in that you add a file to your repo to configure how the CI checks will run. But the BIOS shell script is designed to be both more natural and more flexible to write than platform-specific files like a Jenkinsfile.

Example

The simplest bios.sh script looks like:

#!/bin/bash
set -ex

# check out commit
echo STAT: Cloning
git clone $URL --branch $REF --single-branch .
git reset --hard $SHA

# run custom test
echo STAT: Testing
true

Take note of:

  • Environment variables like the repo URL, PR branch REF, commit SHA
  • Script STAT: status messages
  • Script exit codes

These primatives make it easy to run custom commands, report progress along the way, and set a final success or failure status.

Here our true test command will always return 0 and set a successful commit status. Replace it with false and we will always see a failed commit status.

A real bios.sh script for a Golang app looks like:

#!/bin/bash
set -ex

mkdir -p src/$PKG && cd src/$PKG && pwd

run -s "Cloning" git clone $URL --branch $REF --single-branch .
git branch --set-upstream-to=origin/$REF $REF
git reset --hard $SHA

PKGS=$(go list ./...)
run -s "Linting"  golint -set_exit_status $PKGS
run -s "Vetting"  go vet -x $PKGS
run -s "Building" go build -v $PKGS
run -s "Testing"  go test -v $PKGS

Now we’ll know if any commit fails to pass “lint”, “vet”, “build” or “test” steps.

Take note of how the shell script makes it easy to check out code as a Golang package. Also note the run utility that wraps our commands with STAT: messages.

Commit Comment

Serverless

BIOS is built on AWS Lambda, serverless technology that offers a fast, reliable,secure and cost effective way to run all the checks.

This eliminates time spent in a queue and initializing containers and the cost of reserving container capacity on other CI services.

Conventions over Configuration

The bios.sh script, environment variables, STAT messages, exit codes and Lambda runtime environment conventions take away most of the complexity of other CI systems. The result is a fast and easy way to control GitHub statues.

Of course this introduces tradeoffs. The script must finish in 5 minute or less and there’s no easy way to customize the runtime environment.

Still, there are plenty of use cases, from running linters to compiling and testing Go apps, where a bios.sh script will be simple to add.

We encourage you to try out the BIOS GitHub app and let us know how it works!