Skip to content

Commit

Permalink
Add scripts to enable builds on Travis CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshihitoh committed Jun 19, 2019
1 parent 0174b07 commit d8289a6
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
language: rust
cache: cargo
env:
global:
- PROJECT_NAME: ut
- RUST_BACKTRACE: full
addons:
apt:
packages:
# For building MUSL static builds on Linux.
- musl-tools
matrix:
fast_finish: true
include:
- os: linux
rust: stable
env: TARGET=x86_64-unknown-linux-musl
- os: osx
rust: stable
env: TARGET=x86_64-apple-darwin
branches:
only:
- master
# NOTE: Need below regex to trigger deploy on push-tags
- /^\d+\.\d+\.\d+.*$/
- /^feature\/.*$/
script: ci/script.bash
before_deploy: ci/before_deploy.bash
deploy:
provider: releases
skip_cleanup: true
file_glob: true
file: deployment/${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.tar.gz
on:
condition: $TRAVIS_RUST_VERSION = stable
repo: yoshihitoh/ut
branch: master
tags: true
api_key:
secure: g2jVMSchLEtb60HNCIMrn671gL0V0rQ7dtzgk0ZsFTXietGBPSSpmLx/aY8/RxvEpYwX0ME4fJStY812fPkeVrWSRhZ+vjtMorkXUMR/dU+OEzyHqwTHP3b13tIh36qyVfIuE0GH8dvQcgsK+VMdWQv2e7ymLe+rRWmpG9pSbzKUjG0KGdv9LLFuNdB26xXtsPV5bMsQkqFmRNibbXoXpNrbF/Sbwsd1sk1DahQbHmcoAN/dxjckQV3XpmVF5xQYUOdFjZUguMuV9Mcey6oQ5XnGu/4EGL4oOk/bJkvW8jAaMhX1kA8UBUvbuqDyxWbNrz6PrL5qXWPoAvfB9tSbbxwyuaV/YNV/rNZsAiqDtYtUr1TE0g5Ic1/Ca3g4P/8zOMnOv6NTtzDdgrJXh2qFx4HBrN0bqOab4lv2gU6vepHH5HhCPhPRwSB933haH1tnbGKcgBe9xng27CwADWvfNbfcAWIeDOcTFW6KVue1ltMt1fHIJzU+5sYAErwFNHLvmFDDQ2DE6iVLdEgW3Ar7ghCzEtZac6kyux5uHp5G29qi1NTZnTo+DVUpEff9whzuVrdTz8mhF1bvyA6QqDkZkR6RQUpUJhIk/0+T968Jq7kdwxLD2mu7MfHcmrZfXlIGeZRrAoqD7Ek3gHdtrIrhV7WL/rdUOSAiJLV8ouFOyhg=
notifications:
email:
33 changes: 33 additions & 0 deletions ci/before_deploy.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

set -exo pipefail

PROJECT_NAME="ut"

make_artifacts() {
cargo build --target "$TARGET" --release
}

make_tarball() {
local tmp_dir="$(mktemp -d)"
local name="${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}"
local staging="$tmp_dir/$name"
mkdir -p "$staging/complete"

local out_dir="$(pwd)/deployment"
mkdir -p "$out_dir"

cp "target/$TARGET/release/$PROJECT_NAME" "$staging/$PROJECT_NAME"
strip "$staging/$PROJECT_NAME"
cp {README.md,LICENSE} "$staging"

(cd "$tmp_dir" && tar czf "$out_dir/$name.tar.gz" "$name")
rm -rf "$tmp_dir"
}

main() {
make_artifacts
make_tarball
}

main
11 changes: 11 additions & 0 deletions ci/script.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -exo pipefail

main() {
rustup target add "$TARGET"
cargo build --target "$TARGET" --verbose
cargo test --target "$TARGET" --all --verbose
}

main

0 comments on commit d8289a6

Please sign in to comment.