[Snapshot tests] Update environment variables for GitHub Actions (#2189)
diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml
index 2a5579b..219cb4a 100644
--- a/.github/workflows/validate.yml
+++ b/.github/workflows/validate.yml
@@ -67,8 +67,6 @@
distribution: 'zulu'
java-version: 11
cache: 'gradle'
- - name: Echo SHA (do not submit)
- run: echo $GITHUB_SHA
- name: Build app
env:
LOTTIE_S3_API_KEY: ${{ secrets.LOTTIE_S3_API_KEY }}
@@ -94,7 +92,7 @@
deploy:
if: github.event_name == 'push' && github.repository == 'airbnb/lottie-android' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
- needs: [lint, unit-test]
+ needs: [lint, unit-test, gradle-wrapper, snapshot-tests]
steps:
- name: Checkout the code
uses: actions/checkout@v2
diff --git a/sample/build.gradle b/sample/build.gradle
index afb90ff..bf60f18 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -14,7 +14,6 @@
versionCode 70
versionName VERSION_NAME
multiDexEnabled true
- buildConfigField("String", "BITRISE_GIT_BRANCH", "\"" + System.getenv("BITRISE_GIT_BRANCH") + "\"")
buildConfigField("String", "GIT_SHA", "\"" + gitSha + "\"")
buildConfigField("String", "GIT_BRANCH", "\"" + gitBranch + "\"")
vectorDrawables.useSupportLibrary = true
diff --git a/snapshot-tests/build.gradle b/snapshot-tests/build.gradle
index 3df2f9e..a8eb824 100644
--- a/snapshot-tests/build.gradle
+++ b/snapshot-tests/build.gradle
@@ -13,9 +13,8 @@
versionCode 1
versionName VERSION_NAME
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- buildConfigField("String", "BITRISE_GIT_BRANCH", "\"" + System.getenv("GITHUB_HEAD_REF") + "\"")
- buildConfigField("String", "GIT_SHA", "\"" + gitSha + "\"")
- buildConfigField("String", "GIT_BRANCH", "\"" + gitBranch + "\"")
+ buildConfigField("String", "GIT_BRANCH", "\"" + System.getenv("GITHUB_HEAD_REF") + "\"")
+ buildConfigField("String", "GIT_SHA", "\"" + System.getenv("GITHUB_SHA") + "\"")
}
buildTypes {
diff --git a/snapshot-tests/src/androidTest/java/com/airbnb/lottie/snapshots/utils/HappoSnapshotter.kt b/snapshot-tests/src/androidTest/java/com/airbnb/lottie/snapshots/utils/HappoSnapshotter.kt
index d73f306..8ee8169 100644
--- a/snapshot-tests/src/androidTest/java/com/airbnb/lottie/snapshots/utils/HappoSnapshotter.kt
+++ b/snapshot-tests/src/androidTest/java/com/airbnb/lottie/snapshots/utils/HappoSnapshotter.kt
@@ -51,7 +51,7 @@
private val bucket = "lottie-happo"
private val happoApiKey = BuildConfig.HappoApiKey
private val happoSecretKey = BuildConfig.HappoSecretKey
- private val gitBranch = URLEncoder.encode((if (BuildConfig.BITRISE_GIT_BRANCH == "null") BuildConfig.GIT_BRANCH else BuildConfig.BITRISE_GIT_BRANCH).replace("/", "_"), "UTF-8")
+ private val gitBranch = URLEncoder.encode((BuildConfig.GIT_BRANCH).replace("/", "_"), "UTF-8")
private val androidVersion = "android${Build.VERSION.SDK_INT}"
private val reportNamePrefixes = listOf(BuildConfig.GIT_SHA, gitBranch, BuildConfig.VERSION_NAME).filter { it.isNotBlank() }
// Use this when running snapshots locally.