Activate Travis CI
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by sharkdp · committed by sharkdp · parent ae47586 · Browse files · 2 files·+196 added−0 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+196 added−0 removed
- other:+196 added−0 removed
Provenance
- Commit
793b561- Tree
a3b43dd- Author
sharkdp <davidpeter@web.de>- Committer
sharkdp <davidpeter@web.de>- Parent
ae47586
2 files changed+196 added−0 removed
added:ci/before_deploy.bash+103 added
1+#!/usr/bin/env bash2+# Building and packaging for release3+4+set -ex5+6+build() {7+ cargo build --target "$TARGET" --release --verbose8+}9+10+pack() {11+ local tempdir12+ local out_dir13+ local package_name14+15+ tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)16+ out_dir=$(pwd)17+ package_name="$PROJECT_NAME-$TRAVIS_TAG-$TARGET"18+19+ # create a "staging" directory20+ mkdir "$tempdir/$package_name"21+22+ # copying the main binary23+ cp "target/$TARGET/release/$PROJECT_NAME" "$tempdir/$package_name/"24+ strip "$tempdir/$package_name/$PROJECT_NAME"25+26+ # readme and license27+ cp README.md "$tempdir/$package_name"28+ cp LICENSE-MIT "$tempdir/$package_name"29+ cp LICENSE-APACHE "$tempdir/$package_name"30+31+ # archiving32+ pushd "$tempdir"33+ tar czf "$out_dir/$package_name.tar.gz" "$package_name"/*34+ popd35+ rm -r "$tempdir"36+}37+38+make_deb() {39+ local tempdir40+ local architecture41+ local version42+ local dpkgname43+ local conflictname44+45+ case $TARGET in46+ x86_64*)47+ architecture=amd6448+ ;;49+ i686*)50+ architecture=i38651+ ;;52+ *)53+ echo "ERROR: unknown target" >&254+ return 155+ ;;56+ esac57+ version=${TRAVIS_TAG#v}58+ if [[ $TARGET = *musl* ]]; then59+ dpkgname=$PROJECT_NAME-musl60+ conflictname=$PROJECT_NAME61+ else62+ dpkgname=$PROJECT_NAME63+ conflictname=$PROJECT_NAME-musl64+ fi65+66+ tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)67+68+ # copy the main binary69+ install -Dm755 "target/$TARGET/release/$PROJECT_NAME" "$tempdir/usr/bin/$PROJECT_NAME"70+ strip "$tempdir/usr/bin/$PROJECT_NAME"71+72+ # readme and license73+ install -Dm644 README.md "$tempdir/usr/share/doc/$PROJECT_NAME/README.md"74+ install -Dm644 LICENSE-MIT "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-MIT"75+ install -Dm644 LICENSE-APACHE "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-APACHE"76+77+ # Control file78+ mkdir "$tempdir/DEBIAN"79+ cat > "$tempdir/DEBIAN/control" <<EOF80+Package: $dpkgname81+Version: $version82+Section: utils83+Priority: optional84+Maintainer: David Peter <mail@david-peter.de>85+Architecture: $architecture86+Provides: $PROJECT_NAME87+Conflicts: $conflictname88+Description: A command-line benchmarking tool.89+EOF90+91+ fakeroot dpkg-deb --build "$tempdir" "${dpkgname}_${version}_${architecture}.deb"92+}93+94+95+main() {96+ build97+ pack98+ if [[ $TARGET = *linux* ]]; then99+ make_deb100+ fi101+}102+103+mainadded:.travis.yml+93 added
1+language: rust2+cache: cargo3+matrix:4+ include:5+ # Stable channel.6+ - os: linux7+ rust: stable8+ env: TARGET=x86_64-unknown-linux-gnu9+ - os: linux10+ rust: stable11+ env: TARGET=x86_64-unknown-linux-musl12+ - os: linux13+ rust: stable14+ env: TARGET=i686-unknown-linux-gnu15+ - os: linux16+ rust: stable17+ env: TARGET=i686-unknown-linux-musl18+ - os: osx19+ rust: stable20+ env: TARGET=x86_64-apple-darwin21+22+ # Minimum Rust supported channel.23+ - os: linux24+ rust: 1.20.025+ env: TARGET=x86_64-unknown-linux-gnu26+ - os: linux27+ rust: 1.20.028+ env: TARGET=x86_64-unknown-linux-musl29+ - os: linux30+ rust: 1.20.031+ env: TARGET=i686-unknown-linux-gnu32+ - os: linux33+ rust: 1.20.034+ env: TARGET=i686-unknown-linux-musl35+ - os: osx36+ rust: 1.20.037+ env: TARGET=x86_64-apple-darwin38+39+addons:40+ apt:41+ packages:42+ # needed for i686-unknown-linux-gnu target43+ - gcc-multilib44+45+env:46+ global:47+ # Default target on travis-ci.48+ # Used as conditional check in the install stage49+ - HOST=x86_64-unknown-linux-gnu50+ # Used on the deployment script51+ - PROJECT_NAME=hyperfine52+53+install:54+ # prevent target re-add error from rustup55+ - if [[ $TRAVIS_OS_NAME = linux && $HOST != $TARGET ]]; then rustup target add $TARGET; fi56+57+script:58+ # Incorporate TARGET env var to the build and test process59+ - cargo build --target $TARGET --verbose60+ - cargo test --target $TARGET --verbose61+62+before_deploy:63+ - bash ci/before_deploy.bash64+65+deploy:66+ provider: releases67+ # NOTE updating the `api_key.secure`68+ # - go to: https://github.com/settings/tokens/new69+ # - generate new token using `public_repo` scope70+ # - encrypt it using: `travis encrypt API_KEY_HERE`71+ # - paste the output below72+ api_key:73+ secure: "RyFdh2lpDmaNhPar7ezsb18Xz+6XFM40y7cZCDRML+Sk+eYK1xtDNfEhDRJU5Qo1ReVsByds/QJTSXr2KmZPk3lXwG3SiN7UtrLUxCxFr6qrcM/iujlKTf5UxeRklkzPXxnH95DEyEgxvgbVhWTGVDWoyMnrVQXZKDy6z1iAiYB5h2Zl1rs+MRb/Enlt5q6XIKAlG0ppGtl8CfYudq5ZiqfJaMWTt9SWm2YskC8FeMc0S3IM6/EhTvaNYLdaarFqVWQEVql+6oCuL3ayPzmGyxLdxM37tIMNQ0f97zxqWodacXTG5ULdRD8if1l/SmTujrtjbZ0KWRjsjOq4vBtxBJKGdprcSiB0xH/hToqqtTSO0z5FPXi5cB8UlK6YLDDHcP3kXNer8CYMLI1VPaUDLTF57/0/RPi2DZiiGfZsIAS6PsICbHdTQVzxQckM4lN1vnAGgkhXIMbztml21pv+QrGy98OZJ0ubf5ztgQhpT0WPH4JXT8M6htsoo8dZf8lQ5aLfmW9RKePJDqixQwPqmimPIkrlxRDTDGII0ZAZws7l779eOLmEcM2tH2HbsUKUCZIG/pRHLSlP45Jn2bULGzuXZ2daq70z6zvIbom0CUzSXIvdTXEZI2AM5RBvPYGGaKI8YlxgRdQvJp3h0BzPdFOXI3RAxscCY7PJpa/RdIg="74+ # for uploading multiple files75+ file_glob: true76+ # NOTE explanation on each env variable77+ # - PROJECT_NAME: name of the project, set on the `env.global` above78+ # - TRAVIS_TAG: tag name that the build is being deployed for, usually the version number79+ # - TARGET: target triple of the build80+ file:81+ - $PROJECT_NAME-$TRAVIS_TAG-$TARGET.*82+ - $PROJECT_NAME*.deb83+ # don't delete artifacts from previous stage84+ skip_cleanup: true85+ on:86+ # deploy only if we push a tag87+ tags: true88+ # deploy only on stable channel that has TARGET env variable sets89+ condition: $TRAVIS_RUST_VERSION = stable && $TARGET != ""90+91+notifications:92+ email:93+ on_success: never