Skip to content

Commit b871741

Browse files
Cross build using TravisCI
1 parent 9ab8f29 commit b871741

File tree

7 files changed

+204
-5
lines changed

7 files changed

+204
-5
lines changed

.travis.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Based on the "trust" template v0.1.2
2+
# https://github.com/japaric/trust/tree/v0.1.2
3+
4+
dist: trusty
5+
language: rust
6+
services: docker
7+
sudo: required
8+
9+
env:
10+
global:
11+
- CRATE_NAME=ff
12+
13+
matrix:
14+
include:
15+
# Linux
16+
- env: TARGET=aarch64-unknown-linux-gnu
17+
- env: TARGET=arm-unknown-linux-gnueabi
18+
- env: TARGET=armv7-unknown-linux-gnueabihf
19+
- env: TARGET=i686-unknown-linux-gnu
20+
- env: TARGET=i686-unknown-linux-musl
21+
- env: TARGET=mips-unknown-linux-gnu
22+
- env: TARGET=mips64-unknown-linux-gnuabi64
23+
- env: TARGET=mips64el-unknown-linux-gnuabi64
24+
- env: TARGET=mipsel-unknown-linux-gnu
25+
- env: TARGET=powerpc-unknown-linux-gnu
26+
- env: TARGET=powerpc64-unknown-linux-gnu
27+
- env: TARGET=powerpc64le-unknown-linux-gnu
28+
- env: TARGET=s390x-unknown-linux-gnu DISABLE_TESTS=1
29+
- env: TARGET=x86_64-unknown-linux-gnu
30+
- env: TARGET=x86_64-unknown-linux-musl
31+
32+
# OSX
33+
- env: TARGET=i686-apple-darwin
34+
os: osx
35+
- env: TARGET=x86_64-apple-darwin
36+
os: osx
37+
38+
# *BSD
39+
- env: TARGET=i686-unknown-freebsd DISABLE_TESTS=1
40+
- env: TARGET=x86_64-unknown-freebsd DISABLE_TESTS=1
41+
- env: TARGET=x86_64-unknown-netbsd DISABLE_TESTS=1
42+
43+
# Testing other channels
44+
- env: TARGET=x86_64-unknown-linux-gnu
45+
rust: nightly
46+
- env: TARGET=x86_64-apple-darwin
47+
os: osx
48+
rust: nightly
49+
50+
before_install:
51+
- set -e
52+
- rustup self update
53+
54+
install:
55+
- sh ci/install.sh
56+
- source ~/.cargo/env || true
57+
58+
script:
59+
- bash ci/script.sh
60+
61+
after_script: set +e
62+
63+
before_deploy:
64+
- sh ci/before_deploy.sh
65+
66+
deploy:
67+
api_key:
68+
secure: "PrLddUmzHiBv+YlPHidGsjNbXFO629zGjJkEKLRITmy9kUppufcNuwuSdoW1sxwiNV0xgVKU+OQuGqNn/NwJOsRk7zmfl4Qga6y7kNxiJ8zslwBs5lpnVgCGk2atloqGgrtX47ykUPFKM5G7TiOlYaBRw0Cjf9M5PzmIbX/FrPwBkEDiv8+ABiWAlihPij3E51OXKiVG/LVRKU7BQAOfADaan9H7Xix7X3QZF3kdO/froo+PKkvTAJEvcteoLbvMOYaRXuOfN+Sa6atCuwybWJkRwbOCh0sZxnw4bfaopnfXihRcDLZu+wexxH2f1Db2+4VpzmNP2BxfrXUrJfQEynU3wGmdT419I3F0AtWSB/lVvRQZZyhWJrpgJ0GMLwDrZfk1QQaN2hSk5N23hQtn7ZrBohGWCXdST579BKQBSE+qHhGVlRhdvReSk0WosSUczaET9fnGBc544aSbLGVxGsRUf85NZ/f77//0hEwz4OAnvLD/Obj4nkvHgcE8wjudcmyGBSWnqmhrVzp/smsSUOyg2V7APEZEBTHMFe4RLkCz+TR5fNn1H5XfPCMw9duEVGTv/+EJ3AhUrac+v7TNWS2Jgn9wdVmabXaGqSQW5dFa9K1P/tXdDQ54sgpDmbz5Zb0+6/lLNW4UP6TTGEgKNx+9rNaKcF0lTXffNWR0qIY="
69+
file_glob: true
70+
file: $CRATE_NAME-$TRAVIS_TAG-$TARGET.*
71+
on:
72+
condition: $TRAVIS_RUST_VERSION = stable
73+
tags: true
74+
provider: releases
75+
skip_cleanup: true
76+
77+
cache: cargo
78+
before_cache:
79+
# Travis can't cache files that are not readable by "others"
80+
- chmod -R a+r $HOME/.cargo
81+
82+
branches:
83+
only:
84+
# release tags
85+
- /^v\d+\.\d+\.\d+.*$/
86+
- master
87+
88+
notifications:
89+
email:
90+
on_success: never

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
[package]
2-
name = "ff"
3-
version = "0.1.0"
2+
name = "find-files"
3+
version = "0.1.1"
4+
description = "Find Files (ff) utility recursively searches the files whose names match the specified RegExp pattern in the provided directory (defaults to the current directory if not provided)."
45
authors = ["Vishal Telangre <[email protected]>"]
56
license = "Unlicense OR MIT"
7+
readme = "README.md"
8+
repository = "https://github.com/vishaltelangre/ff"
69

710
[dependencies]
811
walkdir = "2"
@@ -18,3 +21,7 @@ features = [ "suggestions", "color" ]
1821

1922
[build-dependencies]
2023
lazy_static = "1.1.0"
24+
25+
[[bin]]
26+
name = "ff"
27+
path = "src/main.rs"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Dual-licensed under [MIT](LICENSE-MIT) or the [UNLICENSE](UNLICENSE).
1212

1313
## Installation
1414

15-
Download the latest executable `ff` binary from the [releases](https://github.com/BurntSushi/ripgrep/releases) page.
15+
Download the latest executable `ff` binary from the [releases](https://github.com/vishaltelangre/ff/releases) page.
1616

1717
## Usage
1818

ci/before_deploy.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This script takes care of building your crate and packaging it for release
2+
3+
set -ex
4+
5+
main() {
6+
local src=$(pwd) \
7+
stage=
8+
9+
case $TRAVIS_OS_NAME in
10+
linux)
11+
stage=$(mktemp -d)
12+
;;
13+
osx)
14+
stage=$(mktemp -d -t tmp)
15+
;;
16+
esac
17+
18+
test -f Cargo.lock || cargo generate-lockfile
19+
20+
cross rustc --bin ff --target $TARGET --release -- -C lto
21+
22+
cp target/$TARGET/release/ff $stage/
23+
24+
cd $stage
25+
tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz *
26+
cd $src
27+
28+
rm -rf $stage
29+
}
30+
31+
main

ci/install.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
set -ex
2+
3+
main() {
4+
local target=
5+
if [ $TRAVIS_OS_NAME = linux ]; then
6+
target=x86_64-unknown-linux-musl
7+
sort=sort
8+
else
9+
target=x86_64-apple-darwin
10+
sort=gsort # for `sort --sort-version`, from brew's coreutils.
11+
fi
12+
13+
# Builds for iOS are done on OSX, but require the specific target to be
14+
# installed.
15+
case $TARGET in
16+
aarch64-apple-ios)
17+
rustup target install aarch64-apple-ios
18+
;;
19+
armv7-apple-ios)
20+
rustup target install armv7-apple-ios
21+
;;
22+
armv7s-apple-ios)
23+
rustup target install armv7s-apple-ios
24+
;;
25+
i386-apple-ios)
26+
rustup target install i386-apple-ios
27+
;;
28+
x86_64-apple-ios)
29+
rustup target install x86_64-apple-ios
30+
;;
31+
esac
32+
33+
# This fetches latest stable release
34+
local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \
35+
| cut -d/ -f3 \
36+
| grep -E '^v[0.1.0-9.]+$' \
37+
| $sort --version-sort \
38+
| tail -n1)
39+
curl -LSfs https://japaric.github.io/trust/install.sh | \
40+
sh -s -- \
41+
--force \
42+
--git japaric/cross \
43+
--tag $tag \
44+
--target $target
45+
}
46+
47+
main

ci/script.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This script takes care of testing your crate
2+
3+
set -ex
4+
5+
# TODO This is the "test phase", tweak it as you see fit
6+
main() {
7+
cross build --target $TARGET
8+
cross build --target $TARGET --release
9+
10+
if [ ! -z $DISABLE_TESTS ]; then
11+
return
12+
fi
13+
14+
# cross test --target $TARGET
15+
# cross test --target $TARGET --release
16+
17+
cross run --target $TARGET
18+
cross run --target $TARGET --release
19+
}
20+
21+
# we don't run the "test phase" when doing deploys
22+
if [ -z $TRAVIS_TAG ]; then
23+
main
24+
fi

0 commit comments

Comments
 (0)