diff --git a/.travis.yml b/.travis.yml index 2adf12c..bbba9cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,6 +79,9 @@ script: - cargo build --verbose --all - cargo test --verbose --all +before_deploy: + - sh ci/before_deploy.sh + deploy: provider: releases # NOTE updating the `api_key.secure` diff --git a/Cargo.toml b/Cargo.toml index 504327b..e781c1b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,3 +35,6 @@ assert_cmd = "0.10" [[bench]] name = "bench" harness = false + +[profile.release] +lto = true \ No newline at end of file diff --git a/ci/before_deploy.sh b/ci/before_deploy.sh new file mode 100644 index 0000000..0805367 --- /dev/null +++ b/ci/before_deploy.sh @@ -0,0 +1,35 @@ +# This script takes care of building your crate and packaging it for release + +set -ex + +main() { + local src=$(pwd) \ + stage= + + case $TRAVIS_OS_NAME in + linux) + stage=$(mktemp -d) + ;; + osx) + stage=$(mktemp -d -t tmp) + ;; + windows) + stage=$(mktemp -d) + ;; + esac + + test -f Cargo.lock || cargo generate-lockfile + + cargo build --target "$TARGET" --release --verbose + + # TODO Update this to package the right artifacts + cp "target/$TARGET/release/$PROJECT_NAME" $stage/ + + cd $stage + tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz * + cd $src + + rm -rf $stage +} + +main \ No newline at end of file