Build static build releases on travis-ci

This commit is contained in:
Nicolas Viennot 2019-10-12 14:13:12 -04:00
parent 44635e752d
commit 74ff522983
3 changed files with 62 additions and 21 deletions

View File

@ -1,10 +1,36 @@
language: c language: c
services:
- docker
matrix: matrix:
include: include:
- compiler: gcc - arch: amd64
- compiler: clang env: PLATFORM=amd64
env: CFLAGS="-g -O2" - arch: amd64
before_install: env: PLATFORM=i386
- sudo apt-get update -qq - arch: arm64
- sudo apt-get -y install debhelper autotools-dev dh-autoreconf file libncurses5-dev libevent-dev pkg-config libutempter-dev build-essential env: PLATFORM=arm32v6
script: (CFLAGS= ./autogen.sh) && ./configure --enable-debug && make - arch: arm64
env: PLATFORM=arm32v7
- arch: arm64
env: PLATFORM=arm64v8
script:
- 'docker build . --tag local-$PLATFORM/tmate-build --build-arg PLATFORM=$PLATFORM'
# On arch=arm64, some directories are not setup correctly, and 'ruby -S gem
# install dpl' required by the release push scripts fails.
- 'if [ "$TRAVIS_TAG" ]; then sudo chown -R $USER: /var/lib/gems /usr/local/bin; fi'
- 'if [ "$TRAVIS_TAG" ]; then ./package_release.sh $TRAVIS_TAG $PLATFORM; fi'
deploy:
provider: releases
api_key:
secure: T2109tjjOsrVLEpJZK/uxmO0AuDGXYFdN4AAsNTmVwu/W5dcX57Kk2TCgqDuLfD21iGGXP0U/OYHM06IfBDODBWCA9P8ASHYsenS7wIiFnvCEMbfzoAFyBMrXN2kNdM2+ho3aqc0xE2lQKOKDLxpGm5FZrzujscXXzxQjWBU5Hk=
skip_cleanup: true
overwrite: true
file_glob: true
file: /tmp/tmate-release/*.tar.*
on:
repo: tmate-io/tmate
branch: master
tags: true

View File

@ -1,4 +1,5 @@
FROM alpine:3.10 ARG PLATFORM=amd64
FROM ${PLATFORM}/alpine:3.10
WORKDIR /build WORKDIR /build
@ -21,7 +22,7 @@ RUN set -ex; \
COPY . . COPY . .
RUN ./autogen.sh RUN ./autogen.sh && ./configure --enable-static
RUN ./configure --enable-static
RUN make -j $(nproc) RUN make -j $(nproc)
RUN strip tmate RUN strip tmate
RUN ./tmate -V

14
package_release.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
set -eux
VERSION=$1
PLATFORM=$2
RELEASE_NAME=tmate-$VERSION-static-linux-$PLATFORM
# This assumes the follow command has already been run:
# docker build . --tag local-$PLATFORM/tmate-build --build-arg PLATFORM=$PLATFORM
mkdir -p /tmp/tmate-release/$RELEASE_NAME
cd /tmp/tmate-release
docker run --rm local-$PLATFORM/tmate-build cat tmate > $RELEASE_NAME/tmate
chmod +x $RELEASE_NAME/tmate
tar -cf - $RELEASE_NAME | xz > tmate-$VERSION-static-linux-$PLATFORM.tar.xz