about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTerin Stock <terinjokes@gmail.com>2017-07-14 23:48:55 -0600
committerTerin Stock <terinjokes@gmail.com>2017-07-14 23:55:34 -0600
commit1b14c5b909dc42f7c104d07b5eb7d82f6b1b2615 (patch)
tree65981ed58ce6a4332121bdb2c78a658504b5e6e5
parentd5b1fc4cea623a0d1699c9c2e693415ac69ca667 (diff)
chore(travis): reproducible archives
Ensure the tar archives are reproducible across builds on Travis, based
on the instructions from reproducible-builds.org[0].

Unfortunately, Go's tooling seems to include metadata from $GOROOT and
$GOPATH into the resulting binaries, so care must be taken in setting up
the build tool chain. Rebuilds in Travis, and those configured
similarly, do result in the same archive.

[0]: https://archive.is/CjjIl
-rw-r--r--.travis.yml5
1 files changed, 4 insertions, 1 deletions
diff --git a/.travis.yml b/.travis.yml
index 48a19e9..450a0de 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,6 @@
 language: go
+dist: trusty
+sudo: false
 go:
   - 1.8.x
 install:
@@ -12,9 +14,10 @@ jobs:
   - stage: Build and Deploy
     go: 1.8.x
     script:
+      - export SOURCE_DATE_EPOCH=$(git show -s --format=%ci ${TRAVIS_TAG:-${TRAVIS_COMMIT}})
       - go build github.com/terinjokes/bakelite
       - "./bakelite github.com/terinjokes/bakelite"
-      - for i in bakelite-*; do tar -czf $i.tar.gz $i; done
+      - for i in bakelite-*; do tar --mtime="${SOURCE_DATE_EPOCH}" --owner=0 --group=0 --numeric-owner -c $i | gzip -n - > $i.tar.gz; done
       - shasum -a 512 bakelite-*.tar.gz | tee sha512sum.txt
     deploy:
       provider: releases