ci updates

This commit is contained in:
Michael Zhang 2018-09-30 07:31:13 -05:00
parent f717a69fd8
commit 14d152d903
No known key found for this signature in database
GPG key ID: A1B65B603268116B
5 changed files with 46 additions and 64 deletions

View file

@ -3,10 +3,10 @@ sudo: required
dist: trusty
script:
- ./ci/check.sh screenshot
- if [ -z "$TRAVIS_TAG" ]; then ./.ci/run.sh check leanshot; fi
before_deploy:
- ./ci/build-release.sh screenshot ${TRAVIS_TAG}-${TRAVIS_OS_NAME}
- ./.ci/run.sh build leanshot ${TRAVIS_TAG}-${TRAVIS_OS_NAME}
deploy:
- provider: releases

View file

@ -1,6 +1,6 @@
FROM ekidd/rust-musl-builder
RUN sudo apt-get update -y && sudo apt-get install -y mesa-common-dev libx11-dev libimlib2-dev
RUN sudo apt-get update -y && sudo apt-get install -y libmesa-dev mesa-common-dev libx11-dev libimlib2-dev
COPY . ./
RUN sudo chown -R rust:rust .

View file

@ -1,34 +0,0 @@
#!/bin/bash
#
# Usage: ./build-release <PROJECT> ${TRAVIS_TAG}-${TRAVIS_OS_NAME}
#
# The latest version of this script is available at
# https://github.com/emk/rust-musl-builder/blob/master/examples/build-release
#
# Called by `.travis.yml` to build release binaries. We use
# ekidd/rust-musl-builder to make the Linux binaries so that we can run
# them unchanged on any distro, including tiny distros like Alpine (which
# is heavily used for Docker containers). Other platforms get regular
# binaries, which will generally be dynamically linked against libc.
#
# If you have a platform which supports static linking of libc, and this
# would be generally useful, please feel free to submit patches.
set -euo pipefail
case `uname -s` in
Linux)
echo "Building static binaries using ekidd/rust-musl-builder"
docker build -t build-"$1"-image .
docker run -it --name build-"$1" build-"$1"-image bash -c 'cargo build --release'
docker cp build-"$1":/home/rust/src/target/x86_64-unknown-linux-musl/release/"$1" "$1"
docker rm build-"$1"
docker rmi build-"$1"-image
zip "$1"-"$2".zip "$1"
;;
*)
echo "Building standard release binaries"
cargo build --release
zip -j "$1"-"$2".zip target/release/"$1"
;;
esac

View file

@ -1,27 +0,0 @@
#!/bin/bash
#
# Usage: ./build-release <PROJECT> ${TRAVIS_TAG}-${TRAVIS_OS_NAME}
#
# The latest version of this script is available at
# https://github.com/emk/rust-musl-builder/blob/master/examples/build-release
#
# Called by `.travis.yml` to build release binaries. We use
# ekidd/rust-musl-builder to make the Linux binaries so that we can run
# them unchanged on any distro, including tiny distros like Alpine (which
# is heavily used for Docker containers). Other platforms get regular
# binaries, which will generally be dynamically linked against libc.
#
# If you have a platform which supports static linking of libc, and this
# would be generally useful, please feel free to submit patches.
set -euo pipefail
case `uname -s` in
Linux)
echo "Building static binaries using ekidd/rust-musl-builder"
docker build -f Dockerfile -t build-"$1"-image .
docker run -it --name build-"$1" build-"$1"-image bash -c 'cargo check'
docker rm build-"$1"
docker rmi build-"$1"-image
;;
esac

43
ci/run.sh Executable file
View file

@ -0,0 +1,43 @@
#!/bin/bash
#
# Modified version of build-release.sh
# Original comments left below.
#
# Usage: ./build-release <PROJECT> ${TRAVIS_TAG}-${TRAVIS_OS_NAME}
#
# The latest version of this script is available at
# https://github.com/emk/rust-musl-builder/blob/master/examples/build-release
#
# Called by `.travis.yml` to build release binaries. We use
# ekidd/rust-musl-builder to make the Linux binaries so that we can run
# them unchanged on any distro, including tiny distros like Alpine (which
# is heavily used for Docker containers). Other platforms get regular
# binaries, which will generally be dynamically linked against libc.
#
# If you have a platform which supports static linking of libc, and this
# would be generally useful, please feel free to submit patches.
set -euo pipefail
VOLUMES="-v $2-target:/home/rust/src/target -v $2-registry:/home/rust/.cargo/registry -v $2-git:/home/rust/.cargo/git"
case $1 in
check)
echo "Building static binaries using rust-musl-builder"
docker build --build-arg TOOLCHAIN="nightly" -f Dockerfile -t build-"$2"-image .
docker rm -f build-"$2" || true
docker run -it --name build-"$2" $VOLUMES build-"$2"-image bash -c 'cargo build --all'
docker rm build-"$2"
docker rmi build-"$2"-image
;;
build)
echo "Building static binaries using rust-musl-builder"
docker build --build-arg TOOLCHAIN="nightly" -t build-"$2"-image .
docker rm -f build-"$2" || true
docker run -it --name build-"$2" $VOLUMES build-"$2"-image bash -c 'cargo build --release --all'
docker cp build-"$2":/home/rust/src/target/x86_64-unknown-linux-musl/release/"$2" "$2"
docker rm build-"$2"
docker rmi build-"$2"-image
tar czvf "$2"-"$3".tar.gz "$2"
;;
esac