summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2018-02-09 00:44:13 +0100
committerNico Williams <nico@cryptonector.com>2018-02-20 12:11:28 -0500
commit68d0048148748493dc2732a8b3a2251767f34d2d (patch)
treed48c3c4ae796926c9298be68611fef0f20bb73b2
parentbafb43e58985b8db21a8c338a7637e6f0e35051f (diff)
Build static binaries and deploy to GH Releases from Travis
-rw-r--r--.travis.yml58
1 files changed, 58 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml
index 99914b94..3ec64674 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -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.
@@ -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