Re-enable matrix build for Java snapshots

Summary:
Change the travis platform to Java and install Node via nvm instead. This
manually reinstalls buck and then publishes a snapshot if it builds and tests
correctly.

Reviewed By: emilsjolander, danielbuechele

Differential Revision: D7567862

fbshipit-source-id: fabdbbb13117ab8ead4eb9f10402a71d30f29c12
This commit is contained in:
Pascal Hartig
2018-04-10 05:00:07 -07:00
committed by Facebook Github Bot
parent d397aa04d7
commit b9fa60fd74
2 changed files with 68 additions and 24 deletions

View File

@@ -1,16 +1,58 @@
language: node_js language: java
node_js:
- "8" env:
- TARGET: website
- TARGET: android
install: install:
- cd website - cd website
- yarn --ignore-scripts - yarn --ignore-scripts
- cd .. - cd ..
cache:
directories:
- $HOME/buck
- $HOME/.gradle
before_install:
- |
if [[ -n "$encrypted_d27e803291ff_iv" ]]; then
openssl aes-256-cbc -K $encrypted_d27e803291ff_key -iv $encrypted_d27e803291ff_iv -in scripts/setup-keys.enc -d >> gradle.properties;
fi
# Android
- |
if [[ $TARGET = "android" ]]; then
pushd $HOME
git clone --depth 1 https://github.com/facebook/buck.git
cd buck
ant
popd
export PATH=$PATH:$HOME/buck/bin/
buck --version
export TERMINAL=dumb
source scripts/android-setup.sh && installAndroidSDK
export ANDROID_SDK=$ANDROID_HOME
export ANDROID_NDK_REPOSITORY=$HOME/android-ndk
export ANDROID_NDK_HOME=$ANDROID_NDK_REPOSITORY/android-ndk-r15c
fi
# Website
- |
if [[ $TARGET = "website" ]]; then
nvm install 8
nvm use 8
fi
script: script:
- cd website - |
- yarn build if [[ $TARGET = "android" ]]; then
- cd .. ./gradlew testDebugUnit && scripts/publish-snapshot.sh
fi
- |
if [[ $TARGET = "website" ]]; then
pushd website
yarn build
popd
fi
deploy: deploy:
provider: pages provider: pages
@@ -23,3 +65,4 @@ deploy:
keep-history: true keep-history: true
on: on:
branch: master branch: master
condition: $TARGET = website

View File

@@ -1,7 +1,8 @@
set -e
function download() { function download() {
echo "Downloading '$1' to '$2' ..."
if hash curl 2>/dev/null; then if hash curl 2>/dev/null; then
curl --retry 10 -L -o "$2" "$1" curl -s -L -o "$2" "$1"
elif hash wget 2>/dev/null; then elif hash wget 2>/dev/null; then
wget -O "$2" "$1" wget -O "$2" "$1"
else else
@@ -12,38 +13,38 @@ function download() {
function installsdk() { function installsdk() {
PROXY_ARGS="" PROXY_ARGS=""
if [[ ! -z "$https_proxy" ]]; then if [[ ! -z "$HTTPS_PROXY" ]]; then
PROXY_HOST="$(cut -d : "$https_proxy" -f 1,1)" PROXY_HOST="$(echo $HTTPS_PROXY | cut -d : -f 1,1)"
PROXY_PORT="$(cut -d : "$https_proxy" -f 2,2)" PROXY_PORT="$(echo $HTTPS_PROXY | cut -d : -f 2,2)"
PROXY_ARGS="--proxy=http --proxy_host=$PROXY_HOST --proxy_port=$PROXY_PORT" PROXY_ARGS="--proxy=http --proxy_host=$PROXY_HOST --proxy_port=$PROXY_PORT"
fi fi
yes | "$ANDROID_HOME/tools/bin/sdkmanager" $PROXY_ARGS $@ echo y | "$ANDROID_HOME"/tools/bin/sdkmanager $PROXY_ARGS "$@"
} }
function installAndroidSDK { function installAndroidSDK {
export ANDROID_HOME=$HOME/android-sdk if [[ ! -d "$HOME/android-sdk" ]]; then
export ANDROID_NDK_REPOSITORY=$HOME/android-ndk
export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$PATH"
if [[ ! -f "$ANDROID_HOME/tools/bin/sdkmanager" ]]; then
TMP=/tmp/sdk$$.zip TMP=/tmp/sdk$$.zip
download 'https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip' $TMP download 'https://dl.google.com/android/repository/tools_r25.2.3-linux.zip' $TMP
unzip -qod "$ANDROID_HOME" "$TMP" unzip -qod "$HOME/android-sdk" $TMP
rm $TMP rm $TMP
fi fi
export ANDROID_NDK_REPOSITORY=$HOME/android-ndk
if [[ ! -d "$ANDROID_NDK_REPOSITORY/android-ndk-r15c" ]]; then if [[ ! -d "$ANDROID_NDK_REPOSITORY/android-ndk-r15c" ]]; then
TMP=/tmp/ndk$$.zip TMP=/tmp/ndk$$.zip
mkdir -p "$ANDROID_NDK_REPOSITORY" mkdir -p "$ANDROID_NDK_REPOSITORY"
download 'https://dl.google.com/android/repository/android-ndk-r15c-darwin-x86_64.zip' $TMP download 'https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip' $TMP
unzip -qod "$ANDROID_NDK_REPOSITORY" "$TMP" unzip -qod "$ANDROID_NDK_REPOSITORY" "$TMP"
rm $TMP rm $TMP
fi fi
mkdir -p "$ANDROID_HOME/licenses/" export ANDROID_HOME=$HOME/android-sdk
echo > "$ANDROID_HOME/licenses/android-sdk-license" export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$PATH"
echo -n d56f5187479451eabf01fb78af6dfcb131a6481e >> "$ANDROID_HOME/licenses/android-sdk-license"
installsdk 'build-tools;26.0.2' 'platform-tools' 'platforms;android-23' 'platforms;android-25' 'extras;android;m2repository' mkdir -p $ANDROID_HOME/licenses/
echo > $ANDROID_HOME/licenses/android-sdk-license
echo -n d56f5187479451eabf01fb78af6dfcb131a6481e > $ANDROID_HOME/licenses/android-sdk-license
installsdk 'build-tools;25.0.3' 'build-tools;26.0.2' 'platforms;android-25' 'platforms;android-26' 'ndk-bundle' 'extras;android;m2repository'
} }