From 52cc1da711f79a5de96d4fe3f3aaa88d7bd1e409 Mon Sep 17 00:00:00 2001 From: David Perez Date: Thu, 12 Jan 2023 08:48:31 -0600 Subject: [PATCH] Add GitHub Actions CI. --- .github/workflows/ci.yml | 86 ++++++++++++++++++++++++++++++++++++++++ .ruby-version | 1 + Gemfile | 4 ++ Gemfile.lock | 14 +++++++ 4 files changed, 105 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .ruby-version create mode 100644 Gemfile create mode 100644 Gemfile.lock diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..57318d9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,86 @@ +name: CI + +on: + pull_request: + +env: + RUBY_VERSION: 2.7.2 + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + java-version: + - 8 + api-version: + - 22 + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + + - name: Prepare Cache + run: | + rm -f ~/.gradle/caches/modules-2/modules-2.lock + rm -fr ~/.gradle/caches/*/plugin-resolution/ + + - name: Cache Gradle Files + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: v1-${{ runner.os }}-gradle-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }} + restore-keys: | + v1-${{ runner.os }}-gradle-${{ matrix.java-version }}- + + - name: AVD cache + uses: actions/cache@v3 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-${{ matrix.api-version }} + + - 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-version }} + 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: Configure Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ env.RUBY_VERSION }} + bundler-cache: true + + - name: Configure JDK + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: ${{ matrix.java-version }} + + - name: Connected Tests + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ matrix.api-version }} + 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: | + adb uninstall com.livefront.bridgesample + ./gradlew connectedAndroidTest + + - name: Unit Tests + run: ./gradlew testReleaseUnitTest diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..37c2961 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.7.2 diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..0e175e9 --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +# frozen_string_literal: true +source "https://rubygems.org" + +ruby "2.7.2" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..38decea --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,14 @@ +GEM + remote: https://rubygems.org/ + specs: + +PLATFORMS + ruby + +DEPENDENCIES + +RUBY VERSION + ruby 2.7.2p137 + +BUNDLED WITH + 2.3.18