Skip to content

Commit

Permalink
Build static binaries and deploy to GH Releases from Travis
Browse files Browse the repository at this point in the history
  • Loading branch information
jirutka authored and nicowilliams committed Feb 20, 2018
1 parent bafb43e commit 68d0048
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ sudo: false

language: c

stages:
- name: test

- name: build
# Don't run build stage for pull requests to save time and resources.
if: type != pull_request


jobs:
include:
# Build with gcc and run tests on Ubuntu.
Expand Down Expand Up @@ -139,6 +147,56 @@ jobs:
- alpine make check


# Build release binary statically linked with musl libc on Alpine Linux
# (inside chroot). If building a tagged commit, then deploy release
# tarball to GitHub Releases.
- &build-alpine
<<: *test-alpine
stage: build
env: ARCH=x86_64

script:
- alpine ./configure --disable-docs --enable-all-static
CFLAGS='-Os -static -no-pie' CXXFLAGS='-Os -static -no-pie'
- alpine make
- alpine strip jq

- jq -V
- ls -lah jq
- file jq
# Ensure that the built executable is really statically linked.
- file jq | grep -Fw 'statically linked'

before_deploy:
- PKGNAME="jq-$TRAVIS_TAG-$ARCH-linux"
- mkdir $PKGNAME && mv jq $PKGNAME/
- tar -czf $PKGNAME.tar.gz $PKGNAME/
- sha256sum $PKGNAME.tar.gz > $PKGNAME.tar.gz.sha256

deploy:
provider: releases
api_key:
secure: # TODO: put encrypted GitHub token here!
file: jq-$TRAVIS_TAG-*.tar.gz*
file_glob: true
skip_cleanup: true
on:
tags: true

# Build binaries for other architectures using QEMU user-mode emulation.
- <<: *build-alpine
env: ARCH=x86

- <<: *build-alpine
env: ARCH=aarch64

- <<: *build-alpine
env: ARCH=armhf

- <<: *build-alpine
env: ARCH=ppc64le


notifications:
email: false

0 comments on commit 68d0048

Please sign in to comment.