From 14d152d90306f2b6869eaadecce48e8ee92b682f Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Sun, 30 Sep 2018 07:31:13 -0500 Subject: [PATCH] ci updates --- .travis.yml | 4 ++-- Dockerfile | 2 +- ci/build-release.sh | 34 ---------------------------------- ci/check.sh | 27 --------------------------- ci/run.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 46 insertions(+), 64 deletions(-) delete mode 100755 ci/build-release.sh delete mode 100755 ci/check.sh create mode 100755 ci/run.sh diff --git a/.travis.yml b/.travis.yml index 04860df..fa5c7ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/Dockerfile b/Dockerfile index c2d9140..0db7bc4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 . diff --git a/ci/build-release.sh b/ci/build-release.sh deleted file mode 100755 index f33be69..0000000 --- a/ci/build-release.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# -# Usage: ./build-release ${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 diff --git a/ci/check.sh b/ci/check.sh deleted file mode 100755 index ad80965..0000000 --- a/ci/check.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# -# Usage: ./build-release ${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 diff --git a/ci/run.sh b/ci/run.sh new file mode 100755 index 0000000..4a1182a --- /dev/null +++ b/ci/run.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# +# Modified version of build-release.sh +# Original comments left below. +# +# Usage: ./build-release ${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