diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 000000000..9ff24c34a --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,183 @@ +name: Android CI +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + workflow_dispatch: + inputs: + SNAPSHOT: + type: boolean + description: Set SNAPSHOT true to publish + +jobs: + lint_markdown_files: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.6' + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Install gem + run: | + gem install awesome_bot + - name: Run tests + run: find . -type f -name '*.md' -exec awesome_bot {} \; + integration_tests: + if: ${{ github.event.inputs.SNAPSHOT != 'true' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + # You should create a personal access token and store it in your repository + token: ${{ secrets.CI_USER_TOKEN }} + repository: 'optimizely/travisci-tools' + path: 'home/runner/travisci-tools' + ref: 'master' + + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + - name: Trigger build + env: + SDK: android + BUILD_NUMBER: ${{ github.run_id }} + TESTAPP_BRANCH: master + GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} + TRAVIS_EVENT_TYPE: ${{ github.event_name }} + GITHUB_CONTEXT: ${{ toJson(github) }} + TRAVIS_REPO_SLUG: ${{ github.repository }} + TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }} + UPSTREAM_REPO: ${{ github.repository }} + TRAVIS_COMMIT: ${{ github.sha }} + TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} + TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} + UPSTREAM_SHA: ${{ github.sha }} + TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} + EVENT_MESSAGE: ${{ github.event.message }} + HOME: 'home/runner' + run: | + echo "$GITHUB_CONTEXT" + home/runner/travisci-tools/trigger-script-with-status-update.sh + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + cache: gradle + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Clean all modules + run: ./gradlew cleanAllModules + - name: Build with Gradle + run: ./gradlew build + test: + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + api-level: [21, 25, 26, 29] + steps: + - name: checkout + uses: actions/checkout@v2 + + - name: set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Gradle cache + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} + + - name: AVD cache + uses: actions/cache@v2 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + ~/.android/debug.keystore + key: avd-${{ matrix.api-level }} + + - name: create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ matrix.api-level }} + force-avd-creation: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: false + script: echo "Generated AVD snapshot for caching." + + - name: run tests + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ matrix.api-level }} + force-avd-creation: false + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: true + script: ./gradlew testAllModulesTravis + publish: + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set env + run: echo "TRAVIS_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + cache: gradle + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Ship + env: + MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }} + MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }} + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + run: TRAVIS_TAG=${{ env.TRAVIS_TAG }} ./gradlew ship + + snapshot: + if: ${{ github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + cache: gradle + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Ship + env: + MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }} + MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }} + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + run: TRAVIS_TAG=BB-SNAPSHOT ./gradlew ship diff --git a/.github/workflows/source_clear_cron.yml b/.github/workflows/source_clear_cron.yml new file mode 100644 index 000000000..4610dca07 --- /dev/null +++ b/.github/workflows/source_clear_cron.yml @@ -0,0 +1,16 @@ +name: Source clear + +on: + schedule: + # Runs "weekly" + - cron: '0 0 * * 0' + +jobs: + source_clear: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Source clear scan + env: + SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }} + run: curl -sSL https://download.sourceclear.com/ci.sh | bash -s – scan \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index cbf7bcbbe..000000000 --- a/.travis.yml +++ /dev/null @@ -1,113 +0,0 @@ -language: android -# you MUST mention trusty https://docs.travis-ci.com/user/languages/android/ -dist: trusty -jdk: oraclejdk8 - -env: - # API 26+ supports "x86" (ANDROID_ABI=x86) emulators only, which are not supported yet in travis VMs - # so API 24 is the highest level we can run with emulator for now - # API-16 build fails in travis - - EMULATOR_API=19 ANDROID_ABI=armeabi-v7a ANDROID_API=29 ANDROID_BUILD_TOOLS=29.0.3 - - EMULATOR_API=21 ANDROID_ABI=armeabi-v7a ANDROID_API=29 ANDROID_BUILD_TOOLS=29.0.3 - - EMULATOR_API=24 ANDROID_ABI=armeabi-v7a ANDROID_API=29 ANDROID_BUILD_TOOLS=29.0.3 - -android: - components: - - tools - - platform-tools - - build-tools-$ANDROID_BUILD_TOOLS - - android-$ANDROID_API - - android-$EMULATOR_API - # Google APIs - - addon-google_apis-google-$ANDROID_API - - addon-google_apis-google-$EMULATOR_API - # Google Play Services - - extra-google-google_play_services - # Support library - - extra-android-support - # Latest artifacts in local repository - - extra-google-m2repository - - extra-android-m2repository - # Emulators - - sys-img-$ANDROID_ABI-android-$EMULATOR_API - -before_install: - #- touch $HOME/.android/repositories.cfg - -before_script: - - echo $TRAVIS_BRANCH - - echo $TRAVIS_TAG - - echo no | android create avd --force -n test -t android-$EMULATOR_API --abi $ANDROID_ABI - - emulator -avd test -no-window & - - scripts/android-wait-for-emulator.sh - - adb shell input keyevent 82 & -script: - - ./gradlew cleanAllModules - - ./gradlew testAllModulesTravis - -# Integration tests need to run first to reset the PR build status to pending -stages: - - name: 'Source Clear' - if: type = cron - - name: 'Lint markdown files' - - name: 'Integration tests' - - name: 'Test' - if: env(SNAPSHOT) IS NOT present - - name: 'Publish' - if: tag IS present - - name: 'Snapshot' - if: env(SNAPSHOT) = true and type = api - -jobs: - include: - - stage: 'Lint markdown files' - os: linux - language: generic - install: gem install awesome_bot - before_script: skip - script: - - find . -type f -name '*.md' -exec awesome_bot {} \; - notifications: - email: false - - - stage: 'Integration tests' - env: - - SDK=android - - BUILD_NUMBER=${TRAVIS_JOB_NUMBER/.} - - SDK_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH - - TESTAPP_BRANCH=master - cache: false - language: minimal - before_install: skip - install: skip - before_script: - - mkdir $HOME/travisci-tools && pushd $HOME/travisci-tools && git init && git pull https://$CI_USER_TOKEN@github.com/optimizely/travisci-tools.git && popd - script: - - $HOME/travisci-tools/trigger-script-with-status-update.sh - after_success: travis_terminate 0 - - - stage: 'Source Clear' - addons: - srcclr: true - before_install: skip - install: skip - before_script: skip - script: skip - after_script: skip - after_success: skip - - - stage: 'Publish' - script: - - ./gradlew ship - after_script: skip - after_success: skip - - - stage: 'Snapshot' - before_install: - # required to accept Android licenses before install - - yes | sdkmanager "platforms;android-29" - before_script: skip - script: - - TRAVIS_TAG=BB-SNAPSHOT ./gradlew ship - after_script: skip - after_success: skip diff --git a/build.gradle b/build.gradle index 763abfadc..d900f3cf0 100644 --- a/build.gradle +++ b/build.gradle @@ -59,8 +59,8 @@ allprojects { } ext { - compile_sdk_version = 29 - build_tools_version = "29.0.3" + compile_sdk_version = 32 + build_tools_version = "30.0.3" min_sdk_version = 14 target_sdk_version = 29 java_core_ver = "3.10.1"