Skip to content

Commit

Permalink
chore: get travis deploy working
Browse files Browse the repository at this point in the history
  • Loading branch information
hoodie committed Oct 5, 2018
1 parent b769d6c commit acf31a5
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 25 deletions.
77 changes: 63 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,63 @@
sudo: required



dist: trusty
services: docker
language: rust
services: docker
sudo: required




env:
global:
# TODO Update this to match the name of your project.
- CRATE_NAME=asciii
- RUST_BACKTRACE=1

matrix:
include:
- os: linux
env: TARGET=i686-unknown-linux-gnu
DOCKER=quay.io/ascii/i686-unknown-linux-gnu:latest
- os: linux
env: TARGET=x86_64-unknown-linux-gnu
DOCKER=quay.io/ascii/x86_64-unknown-linux-gnu:latest
- os: osx
env: TARGET=i686-apple-darwin
# - os: linux
# env: TARGET=i686-unknown-linux-gnu
# DOCKER=quay.io/ascii/i686-unknown-linux-gnu:latest
# - os: linux
# env: TARGET=x86_64-unknown-linux-gnu
# DOCKER=quay.io/ascii/x86_64-unknown-linux-gnu:latest
# - os: osx
# env: TARGET=i686-apple-darwin
- os: osx
env: TARGET=x86_64-apple-darwin

# Just testing for right cross compilers for these targets.
# - os: linux
# env: TARGET=x86_64-unknown-linux-gnu
# DOCKER=quay.io/ascii/x86_64-unknown-linux-gnu:latest
- os: linux
env: TARGET=i686-unknown-linux-musl
env: TARGET=x86_64-unknown-linux-musl
DOCKER=quay.io/ascii/i686-unknown-linux-musl:latest
SKIP_TESTS=1
- os: linux
env: TARGET=i686-pc-windows-gnu
DOCKER=quay.io/ascii/i686-pc-windows-gnu:latest
env: TARGET=i686-unknown-linux-musl
DOCKER=quay.io/ascii/i686-unknown-linux-musl:latest
SKIP_TESTS=1
# - os: linux
# env: TARGET=i686-pc-windows-gnu
# DOCKER=quay.io/ascii/i686-pc-windows-gnu:latest
# SKIP_TESTS=1
- os: linux
env: TARGET=x86_64-pc-windows-gnu
DOCKER=quay.io/ascii/x86_64-pc-windows-gnu:latest
SKIP_TESTS=1

before_install:
- set -e
- rustup self update

install:
- sh ci/install.sh
- curl https://static.rust-lang.org/rustup.sh |
sh -s -- --prefix=$HOME/rust --with-target=$TARGET
- source ~/.cargo/env || true


script:
- if [ ! -z "$DOCKER" ]; then
Expand All @@ -55,6 +80,30 @@ script:
PATH=$HOME/rust/bin:$PATH sh ci/run.sh;
fi

after_script: set +e

before_deploy:
- sh ci/before_deploy.sh

deploy:
# TODO update `api_key.secure`
# - Create a `public_repo` GitHub token. Go to: https://github.com/settings/tokens/new
# - Encrypt it: `travis encrypt 0123456789012345678901234567890123456789
# - Paste the output down here
api_key:
secure: "oqulSaMfkOAgll1UU2TQ28jey70kSSPW6DCx3J1HQdEZXH2zGL6HZWiauu6hxIBoyNx9CQ7tHlXGJ5Xo3ebmEu/1UZfNwQ3FX8TgS1e8VmIvQI8ZZGBhlG2bi4tN+equHRKx/J9+zXrgJV0FKSCU4Zar3A0AgbV+Jc0Yrzo2RBJj0jFRo3JNe+4vIaWPB43zPaJKJr4faaTmQI9ikNJOQZh0fte3sFL0H7AzY5/mi1T8I3fhaagUOl/fLEFXxMmpBY5+dr0pLO68QS1l3ChpCdCjnOXdjchqtaMpM/E6PrK0baXmn7laxkNXVC0Ia7RMPmYsSCmBCp+KhgGQwn3krqW0rSehZH+w4XuQFun5Tx9zfL+S7K8M7lLivJwBuT6LchLhSexL0YxHoBveUTwNTaHew3doSmLRm9tQn/wIeWgujyVyWXLkrzF5KUvkFVJE7JPlfUHf1LbmIyUoH+e4Yuao73/mczgBitYbSl9eUut4QuQi9Ld+KDCO4xgaQv/mDZHTlBdQ2UXvERBKd1ryzzjOUTP+jUQrtqgUc0shasMcb7Scx09rE0+5yakoQLYC8xHy3BX1jCGVZi4ri065yX/V82BSt3BNGDiPiHx2McYrwewWcpbyJI2+NRy2Me7YafZz2VNaL5gIiqRn0qQA5P4eHy+HzwirRDCG+Iu5CK8="
file_glob: true
file: $CRATE_NAME-$TRAVIS_TAG-$TARGET.*
on:
# TODO Here you can pick which targets will generate binary releases
# In this example, there are some targets that are tested using the stable
# and nightly channels. This condition makes sure there is only one release
# for such targets and that's generated using the stable channel
condition: $TRAVIS_RUST_VERSION = stable
tags: true
provider: releases
skip_cleanup: true

cache: cargo
before_cache:
# Travis can't cache files that are not readable by "others"
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pretty_assertions = "0.5"

[features]
default = ["cli", "document_export", "git_statuses", "serialization", "deserialization"]
full_tool = ["cli", "document_export", "git_statuses", "serialization", "deserialization", "localize", "version_string", "shell", "meta"]
full_tool = ["cli", "document_export", "git_statuses", "serialization", "deserialization", "shell", "meta"]
server = ["rocket", "rocket_codegen", "rocket_contrib", "rocket_cors", "openssl-sys", "openssl-probe", "serialization", "version_string", "meta"]
webapp = ["server", "include_dir" ] # build the frontend app

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The ascii-invoicer is a command-line tool that manages projects and stores them

## Installation

To use \(experimental\) features use the `--feature` flag.
To use \(experimental\) features use the `--features` flag.
Please check the `Cargo.toml` for an up-to-date list of features.
To get a full cli tool build with the feature `full_tool`.

Expand Down
13 changes: 10 additions & 3 deletions ci/before_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@ main() {
test -f Cargo.lock || cargo generate-lockfile

# TODO Update this to build the artifacts that matter to you
cross rustc --bin asciii --target $TARGET --release -- -C lto
cross rustc --bin asciii --target $TARGET --features full_tool --release -- -C lto

ls target/$TARGET/release/

# TODO Update this to package the right artifacts
cp target/$TARGET/release/asciii $stage/
if test "$TARGET" = "x86_64-pc-windows-gnu"
then
cp target/$TARGET/release/asciii.exe $stage/
else
cp target/$TARGET/release/asciii $stage/
fi

cd $stage
tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz *
Expand All @@ -30,4 +37,4 @@ main() {
rm -rf $stage
}

main
main
47 changes: 47 additions & 0 deletions ci/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
set -ex

main() {
local target=
if [ $TRAVIS_OS_NAME = linux ]; then
target=x86_64-unknown-linux-musl
sort=sort
else
target=x86_64-apple-darwin
sort=gsort # for `sort --sort-version`, from brew's coreutils.
fi

# Builds for iOS are done on OSX, but require the specific target to be
# installed.
case $TARGET in
aarch64-apple-ios)
rustup target install aarch64-apple-ios
;;
armv7-apple-ios)
rustup target install armv7-apple-ios
;;
armv7s-apple-ios)
rustup target install armv7s-apple-ios
;;
i386-apple-ios)
rustup target install i386-apple-ios
;;
x86_64-apple-ios)
rustup target install x86_64-apple-ios
;;
esac

# This fetches latest stable release
local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \
| cut -d/ -f3 \
| grep -E '^v[0.1.0-9.]+$' \
| $sort --version-sort \
| tail -n1)
curl -LSfs https://japaric.github.io/trust/install.sh | \
sh -s -- \
--force \
--git japaric/cross \
--tag $tag \
--target $target
}

main
15 changes: 9 additions & 6 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

set -ex

echo "toolchain versions\n------------------"
main() {
echo "toolchain versions\n------------------"

rustc -vV
cargo -vV
rustc -vV
cargo -vV

cargo build --target $TARGET
cargo build --target $TARGET --release
cargo check --target $TARGET --features full_tool
cargo build --target $TARGET --features full_tool --release
cargo test --target $TARGET --features full_tool
}

if [ -z "$SKIP_TESTS" ]; then
cargo test --target $TARGET
main
fi

0 comments on commit acf31a5

Please sign in to comment.