travis builds

This commit is contained in:
Michael Zhang 2018-09-09 21:27:44 -05:00
parent eaf2385d1c
commit a914f940ae
No known key found for this signature in database
GPG key ID: A1B65B603268116B
5 changed files with 72 additions and 32 deletions

2
.dockerignore Normal file
View file

@ -0,0 +1,2 @@
/target
**/*.rs.bk

View file

@ -1,23 +1,16 @@
language: rust language: rust
sudo: required
cache: cargo
rust: rust:
- stable - stable
- nightly - nightly
os: os: linux
- linux
matrix: matrix:
fast_finish: true fast_finish: true
sudo: true
dist: trusty services:
addons: - docker
apt:
update: true
packages:
- cmake
- libgles2-mesa-dev
- libglew-dev
- libglfw3-dev
- libglm-dev
- libgtk-3-dev
before_script: before_script:
- git clone https://github.com/naelstrof/slop.git - git clone https://github.com/naelstrof/slop.git
@ -26,24 +19,21 @@ before_script:
- make && sudo make install - make && sudo make install
script: script:
- cargo build --all - if [ -z "$TRAVIS_TAG" ]; then cargo test --all; fi
- cargo test --all
before_deploy: before_deploy:
- cargo build --release --all - ./ci/build-release.sh dip ${TRAVIS_TAG}-${TRAVIS_OS_NAME}
- mkdir -p release
- cp target/release/screenshot release
- cp LICENSE release
- tar czvf monto-rs-$(TARGET)-$(TRAVIS_TAG).tar.gz release
deploy: deploy:
provider: releases - provider: releases
api_key: api_key:
secure: ZCA3+LjTzliSC3m9DjcEYZOsRhaI5r9LAHfuw5HuaLYbprbEVwqLCTV1ioe7F9dLPembqGoGEsVnWAsrAUP0C9BRUuOrZMYvTOS3qTwSX7pPc/fsNUzP9uc6XPIMQ7/QeakmpgVYvObt9/1Wxui715nPmj9h+YIB4P3BUT8VsufzG0LogNSTwkhicM19O9oFhoCg39qQBueBe2SrS35dqvofSoJlEk2wSBBesQ9xuw9goP8ZkTKD3w/ZmPUS9RuWi1FSzsUcnLGCEMwYxLk9CBnG9I0G8kvDF194UYq7YnlaK4sn4AG5UxkMYcWN573vb+KX56VoHa57Z7qNIoUy1Kk0MatIjPIxd2LQJSTl7I5sckfoq61wihRYYj8R1qI4V4mqBX+MHFwyfs7/XT2pVfPHeflvJ4MMZW5t+OYWv8LfwFgufbLyYS79ZkBIjVnk2ligSv8kSPcuTtnSzp6UJlHsEbRDlWcciAYA92d2bggz7BrSG+X1eDAVto+bGdAeAp5zgRPVKwbpA9aD52y2GmlMh4Z+GcjhF6U7z+2AYRalH9X8d4mSdQ7KuhFfigoR/84tO+kC5QeKnf3FfgXPzOimt8xCsd2MFDrg2sPvgFkQGyM0ihB9NnNBfiFrQrRP3+DyTCI3TqOfkz8QKe4h7DxefR1t+YvheNZjGtC8C+E= secure: ZCA3+LjTzliSC3m9DjcEYZOsRhaI5r9LAHfuw5HuaLYbprbEVwqLCTV1ioe7F9dLPembqGoGEsVnWAsrAUP0C9BRUuOrZMYvTOS3qTwSX7pPc/fsNUzP9uc6XPIMQ7/QeakmpgVYvObt9/1Wxui715nPmj9h+YIB4P3BUT8VsufzG0LogNSTwkhicM19O9oFhoCg39qQBueBe2SrS35dqvofSoJlEk2wSBBesQ9xuw9goP8ZkTKD3w/ZmPUS9RuWi1FSzsUcnLGCEMwYxLk9CBnG9I0G8kvDF194UYq7YnlaK4sn4AG5UxkMYcWN573vb+KX56VoHa57Z7qNIoUy1Kk0MatIjPIxd2LQJSTl7I5sckfoq61wihRYYj8R1qI4V4mqBX+MHFwyfs7/XT2pVfPHeflvJ4MMZW5t+OYWv8LfwFgufbLyYS79ZkBIjVnk2ligSv8kSPcuTtnSzp6UJlHsEbRDlWcciAYA92d2bggz7BrSG+X1eDAVto+bGdAeAp5zgRPVKwbpA9aD52y2GmlMh4Z+GcjhF6U7z+2AYRalH9X8d4mSdQ7KuhFfigoR/84tO+kC5QeKnf3FfgXPzOimt8xCsd2MFDrg2sPvgFkQGyM0ihB9NnNBfiFrQrRP3+DyTCI3TqOfkz8QKe4h7DxefR1t+YvheNZjGtC8C+E=
file: screenshot-$(TARGET)-$(TRAVIS_TAG).tar.gz file_glob: true
file:
- screenshot-*
on: on:
condition: $TRAVIS_RUST_VERSION = stable
tags: true tags: true
repo: iptq/screenshot
skip_cleanup: true skip_cleanup: true
notifications: notifications:

View file

@ -1,6 +1,6 @@
[package] [package]
name = "screenshot" name = "screenshot"
version = "0.1.0" version = "0.2.0"
authors = ["Michael Zhang <failed.down@gmail.com>"] authors = ["Michael Zhang <failed.down@gmail.com>"]
build = "src/build.rs" build = "src/build.rs"

14
Dockerfile Normal file
View file

@ -0,0 +1,14 @@
FROM ekidd/rust-musl-builder
RUN sudo apt-get update -y && sudo apt-get install -y \
cmake \
libgles2-mesa-dev \
libglew-dev \
libglfw3-dev \
libglm-dev \
libgtk-3-dev
COPY . ./
RUN sudo chown -R rust:rust .
CMD cargo build --release

34
ci/build-release.sh Executable file
View file

@ -0,0 +1,34 @@
#!/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
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