diff options
author | Sam Tay <sam.chong.tay@gmail.com> | 2020-06-25 02:10:48 -0700 |
---|---|---|
committer | Sam Tay <sam.chong.tay@gmail.com> | 2020-06-25 02:23:23 -0700 |
commit | 1c90502a3c4f735a7546a1147b100946f1a5af01 (patch) | |
tree | c932a54055229911f120fcc15e54d266bfae849f /ci/install.sh | |
parent | 3216d47824f3f15e11a60132b2c559fc4796d59c (diff) |
Add CI courtesy of trust & cross
Diffstat (limited to 'ci/install.sh')
-rw-r--r-- | ci/install.sh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/ci/install.sh b/ci/install.sh new file mode 100644 index 0000000..3e96e97 --- /dev/null +++ b/ci/install.sh @@ -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/rust-embedded/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 rust-embedded/cross \ + --tag $tag \ + --target $target +} + +main |