From dbdb62c4cb1ee4c0448c64e10398435553351d1a Mon Sep 17 00:00:00 2001 From: Sam Judd Date: Mon, 23 Nov 2020 14:45:17 -0800 Subject: [PATCH] Switch to Github Actions CI. --- .github/workflows/build.yml | 25 ++++++++++++ .travis.yml | 41 -------------------- scripts/{travis_unit.sh => ci_unit.sh} | 0 scripts/travis_after_success.sh | 7 ---- scripts/travis_before_script.sh | 7 ---- scripts/travis_create_emulator.sh | 11 ------ scripts/travis_firebase.sh | 32 ---------------- scripts/travis_instrumentation.sh | 17 --------- scripts/travis_samples.sh | 53 -------------------------- scripts/travis_script.sh | 23 ----------- scripts/travis_sonatype_publish.sh | 20 ---------- 11 files changed, 25 insertions(+), 211 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml rename scripts/{travis_unit.sh => ci_unit.sh} (100%) delete mode 100755 scripts/travis_after_success.sh delete mode 100755 scripts/travis_before_script.sh delete mode 100755 scripts/travis_create_emulator.sh delete mode 100755 scripts/travis_firebase.sh delete mode 100755 scripts/travis_instrumentation.sh delete mode 100755 scripts/travis_samples.sh delete mode 100755 scripts/travis_script.sh delete mode 100755 scripts/travis_sonatype_publish.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..3ae9064c51 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,25 @@ +name: Android CI + +on: + push: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: '1.8' + - name: Build and run unit tests with Gradle + run: ./scripts/ci_unit.sh + - name: Publish to Sonatype + env: + NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} + NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'bumptech/glide' }} + run: ./gradlew uploadArchives -PNEXUS_USERNAME="${NEXUS_USERNAME}" -PNEXUS_PASSWORD="${NEXUS_PASSWORD}" + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 022c21ab1b..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,41 +0,0 @@ -language: android -sudo: false -dist: trusty - -before_install: - - mkdir "$ANDROID_HOME/licenses" || true - - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e" > "$ANDROID_HOME/licenses/android-sdk-license" - - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd\n504667f4c0de7af1a06de9f4b1727b84351f2910" > "$ANDROID_HOME/licenses/android-sdk-preview-license" - - yes | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;29.0.2" "platforms;android-29" - -android: - components: - # https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943 - - tools - - tools - -jdk: - - oraclejdk8 - -env: - matrix: - - COMPONENT=unit - -before_script: - - ./scripts/travis_before_script.sh - -script: - - ./scripts/travis_script.sh - -after_success: - - ./scripts/travis_after_success.sh - -before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ -cache: - directories: - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ - - $HOME/.android/build-cache - diff --git a/scripts/travis_unit.sh b/scripts/ci_unit.sh similarity index 100% rename from scripts/travis_unit.sh rename to scripts/ci_unit.sh diff --git a/scripts/travis_after_success.sh b/scripts/travis_after_success.sh deleted file mode 100755 index d9c2a30425..0000000000 --- a/scripts/travis_after_success.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -set -e - -if [ "$COMPONENT" == "unit" ]; then - ./scripts/travis_sonatype_publish.sh -fi diff --git a/scripts/travis_before_script.sh b/scripts/travis_before_script.sh deleted file mode 100755 index e45e901aff..0000000000 --- a/scripts/travis_before_script.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -# Copies our debug.keystore file to its expected location to avoid a bug -# where the Android build system seems to occasionally fail to generate it. - -set -e - -cp debug.keystore ~/.android/debug.keystore diff --git a/scripts/travis_create_emulator.sh b/scripts/travis_create_emulator.sh deleted file mode 100755 index 997ffcdcc9..0000000000 --- a/scripts/travis_create_emulator.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -e - -target="system-images;android-${ANDROID_TARGET};default;armeabi-v7a" -echo y | sdkmanager --update -echo y | sdkmanager --install $target -avdmanager create avd --force -n test -k $target --device "Nexus 4" -c 2048M -QEMU_AUDIO_DRV=none $ANDROID_HOME/emulator/emulator -avd test -no-window -memory 2048 & - -exit 0 diff --git a/scripts/travis_firebase.sh b/scripts/travis_firebase.sh deleted file mode 100755 index e405462a55..0000000000 --- a/scripts/travis_firebase.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -set -e - -if [ ! "$firebase_enabled" == "true" ]; then - echo "Unable to run Firebase tests for pull requests, exiting" - exit 0 -fi - -./gradlew :instrumentation:assembleDebug \ - :instrumentation:assembleDebugAndroidTest \ - --parallel \ - -PDISABLE_ERROR_PRONE & -pid=$! -./scripts/install_firebase.sh -wait $pid - -apk_dir=instrumentation/build/outputs/apk -./google-cloud-sdk/bin/gcloud firebase test android run \ - --type instrumentation \ - --app $apk_dir/debug/instrumentation-debug.apk \ - --test $apk_dir/androidTest/debug/instrumentation-debug-androidTest.apk \ - --device model=Nexus6P,version=27,locale=en,orientation=portrait \ - --device model=Nexus6P,version=26,locale=en,orientation=portrait \ - --device model=Nexus6P,version=25,locale=en,orientation=portrait \ - --device model=Nexus6P,version=24,locale=en,orientation=portrait \ - --device model=Nexus6P,version=23,locale=en,orientation=portrait \ - --device model=Nexus6,version=22,locale=en,orientation=portrait \ - --device model=Nexus5,version=21,locale=en,orientation=portrait \ - --device model=Nexus5,version=19,locale=en,orientation=portrait \ - --project android-glide \ - --no-auto-google-login \ diff --git a/scripts/travis_instrumentation.sh b/scripts/travis_instrumentation.sh deleted file mode 100755 index d365034bf5..0000000000 --- a/scripts/travis_instrumentation.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -set -e - -echo "Starting emulator for $COMPONENT tests" -./scripts/travis_create_emulator.sh & - -./gradlew :instrumentation:assembleDebug \ - :instrumentation:assembleDebugAndroidTest \ - --parallel \ - -PDISABLE_ERROR_PRONE - -echo "Waiting for emulator..." -android-wait-for-emulator - -for i in {1..3}; do ./gradlew :instrumentation:connectedDebugAndroidTest && break; done - diff --git a/scripts/travis_samples.sh b/scripts/travis_samples.sh deleted file mode 100755 index 45fe598277..0000000000 --- a/scripts/travis_samples.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env bash - -set -e - -./gradlew :samples:flickr:build \ - :samples:giphy:build \ - :samples:contacturi:build \ - :samples:gallery:build \ - :samples:imgur:build \ - :samples:svg:build \ - --parallel \ - -PERROR_PRONE="false" & -pid=$! - -if [ ! "$firebase_enabled" == "true" ]; then - wait $pid - echo "Unable to run Firebase tests for pull requests, exiting" - exit 0 -else - ./scripts/install_firebase.sh - wait $pid -fi - - -declare -a samples=("flickr" - "giphy" - "contacturi" - "gallery" - "imgur" - "svg") -pids=() - -for sample in "${samples[@]}" -do - sample_dir="samples/${sample}/build/outputs/apk/debug" - sample_apk="${sample_dir}/${sample}-debug.apk" - ./google-cloud-sdk/bin/gcloud firebase test android run \ - --type robo \ - --app $sample_apk \ - --device model=Nexus6P,version=26,locale=en,orientation=portrait \ - --project android-glide \ - --no-auto-google-login \ - --timeout 5m \ - & - pids+=("$!") -done - -for current in "${pids[@]}" -do - wait $current -done - - diff --git a/scripts/travis_script.sh b/scripts/travis_script.sh deleted file mode 100755 index ab103e8752..0000000000 --- a/scripts/travis_script.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -set -e - -if [ -z ${encrypted_ad2664a1c4dd_key+x} ] || [ -z ${encrypted_ad2664a1c4dd_iv+x} ] || [ -z ${GCLOUD_FILE} ]; then - export firebase_enabled="false" -else - export firebase_enabled="true" -fi - - -if [ "$COMPONENT" == "unit" ]; then - ./scripts/travis_unit.sh -elif [ "$COMPONENT" == "instrumentation" ]; then - ./scripts/travis_instrumentation.sh -elif [ "$COMPONENT" == "samples" ]; then - ./scripts/travis_samples.sh -elif [ "$COMPONENT" == "firebase" ]; then - ./scripts/travis_firebase.sh -else - echo "Unrecognized component: $COMPONENT" - exit 1 -fi diff --git a/scripts/travis_sonatype_publish.sh b/scripts/travis_sonatype_publish.sh deleted file mode 100755 index 4e7c7cf8b4..0000000000 --- a/scripts/travis_sonatype_publish.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# Publishes the latest snapshot to Sonatype. Works only for SNAPSHOT versions. -# Based closely on material from -# http://benlimmer.com/2014/01/04/automatically-publish-to-sonatype-with-gradle-and-travis-ci. - -if [ "$SONATYPE_PUBLISH" == "true" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "$SONATYPE_PUBLISH_BRANCH" ]; then - echo -e "Starting publish to Sonatype...\n" - - ./gradlew uploadArchives -PNEXUS_USERNAME="${NEXUS_USERNAME}" -PNEXUS_PASSWORD="${NEXUS_PASSWORD}" - RETVAL=$? - - if [ $RETVAL -eq 0 ]; then - echo 'Completed publish!' - else - echo 'Publish failed.' - return 1 - fi -else - echo 'Skipping Sonatype push' -fi