Skip to content

Commit d822416

Browse files
MaesterChestnutChris Chestnut
andauthored
automate version validation with prod test suite (#8015)
Co-authored-by: Chris Chestnut <cchestnut@google.com>
1 parent f5b1aba commit d822416

5 files changed

Lines changed: 45 additions & 13 deletions

File tree

.github/workflows/app-distribution-gradle-compatibility-tests.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,30 @@ jobs:
2525
java-version: 17
2626
distribution: temurin
2727
cache: gradle
28+
29+
- name: Setup local.properties for prodTest
30+
run: |
31+
echo "${{ secrets.INTEG_TESTS_FAD_GRADLE_PROD_TEST_PROPERTIES }}" > local.properties
32+
2833
- name: Add FAD service-credentials.json
2934
env:
3035
INTEG_TESTS_FAD_SERVICE_CREDENTIALS: ${{ secrets.INTEG_TESTS_FAD_SERVICE_CREDENTIALS }}
3136
if: env.INTEG_TESTS_FAD_SERVICE_CREDENTIALS != '' && env.INTEG_TESTS_FAD_SERVICE_CREDENTIALS != 'null'
3237
run: |
3338
echo $INTEG_TESTS_FAD_SERVICE_CREDENTIALS | base64 -d > firebase-appdistribution-gradle/service-credentials.json
39+
3440
- name: Run tests
3541
id: tests
42+
env:
43+
FIREBASE_TOKEN: ${{ secrets.INTEG_TESTS_FAD_FIREBASE_TOKEN }}
3644
run: |
3745
./gradlew \
38-
:firebase-appdistribution-gradle:integrationTest
46+
:firebase-appdistribution-gradle:prodTest \
47+
:firebase-appdistribution-gradle:integrationTest --continue
3948
4049
- name: Upload Test Report
4150
if: failure()
4251
uses: actions/upload-artifact@v4
4352
with:
4453
name: integration-test-report
45-
path: firebase-appdistribution-gradle/build/reports/tests/integrationTest/
54+
path: firebase-appdistribution-gradle/build/reports/tests/

firebase-appdistribution-gradle/firebase-appdistribution-gradle.gradle

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,23 @@ sourceSets {
8989
}
9090

9191
// Source set for integration tests
92-
integrationTest
92+
integrationTest {
93+
java {
94+
srcDirs += ['src/testUtil/java']
95+
}
96+
kotlin {
97+
srcDirs += ['src/testUtil/java']
98+
}
99+
}
93100

94-
prodTest
101+
prodTest {
102+
java {
103+
srcDirs += ['src/testUtil/java']
104+
}
105+
kotlin {
106+
srcDirs += ['src/testUtil/java']
107+
}
108+
}
95109

96110
// Source set for Gradle Runner test build. Gradle Runner test builds are run in separate
97111
// processes i.e. test build does not share same class paths as test process. So we need
@@ -185,6 +199,10 @@ task prodTest(type: Test) {
185199
environment 'FIREBASE_TOKEN', token
186200
}
187201
}
202+
203+
testLogging {
204+
showStandardStreams = true
205+
}
188206
}
189207

190208
test {

firebase-appdistribution-gradle/src/integrationTest/java/com/google/firebase/appdistribution/gradle/UploadDistributionTaskTest.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -719,10 +719,6 @@ class UploadDistributionTaskTest {
719719
}
720720

721721
companion object {
722-
// Latest gradle, AGP and google-services plugin versions. Update this when new releases come
723-
// out.
724-
// Also remember to update the latest AGP/gradle versions in BeePlusGradleProject.java.
725-
// firebase-appdistribution-gradle/src/prodTest/java/com/google/firebase/appdistribution/gradle/BeePlusGradleProject.java#L59-L60
726722
private val LATEST_GRADLE_VERSION = VersionUtils.fetchLatestGradleVersion()
727723
private val LATEST_AGP_VERSION = VersionUtils.fetchLatestAgpVersion()
728724
private val LATEST_GOOGLE_SERVICES_VERSION = VersionUtils.fetchLatestGoogleServicesVersion()
@@ -746,6 +742,7 @@ class UploadDistributionTaskTest {
746742
@org.junit.BeforeClass
747743
@JvmStatic
748744
fun logVersions() {
745+
LOGGER.info("Integration tests using versions:")
749746
LOGGER.info("Latest Gradle Version: $LATEST_GRADLE_VERSION")
750747
LOGGER.info("Latest AGP Version: $LATEST_AGP_VERSION")
751748
LOGGER.info("Latest Google Services Version: $LATEST_GOOGLE_SERVICES_VERSION")

firebase-appdistribution-gradle/src/prodTest/java/com/google/firebase/appdistribution/gradle/BeePlusGradleProject.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.Collection;
2929
import java.util.List;
3030
import java.util.Random;
31+
import java.util.logging.Logger;
3132
import java.util.stream.Collectors;
3233
import org.apache.commons.io.FileUtils;
3334
import org.gradle.testkit.runner.BuildResult;
@@ -56,10 +57,17 @@ private static String getRequiredSystemProperty(String propertyName) {
5657
}
5758

5859
static final String PACKAGE_NAME = "com.firebase.appdistribution.prober";
59-
// Also remember to update the latest AGP/gradle versions in UploadDistributionTaskTest.kt
60-
// firebase-appdistribution-gradle/src/integrationTest/java/com/google/firebase/appdistribution/gradle/UploadDistributionTaskTest.kt#L724-L726
61-
static final String LATEST_AGP_VERSION = "9.2.1";
62-
static final String LATEST_GRADLE_VERSION = "9.5.0";
60+
static final String LATEST_AGP_VERSION = VersionUtils.INSTANCE.fetchLatestAgpVersion();
61+
static final String LATEST_GRADLE_VERSION = VersionUtils.INSTANCE.fetchLatestGradleVersion();
62+
63+
private static final Logger LOGGER = Logger.getLogger(BeePlusGradleProject.class.getName());
64+
65+
static {
66+
LOGGER.info("Production compat tests using versions:");
67+
LOGGER.info("Latest Gradle Version: " + LATEST_GRADLE_VERSION);
68+
LOGGER.info("Latest AGP Version: " + LATEST_AGP_VERSION);
69+
}
70+
6371
// The project number for App Distro Probes. We need to use this project
6472
// because this is the one that's actually linked to play for BeePlus,
6573
// which is required for AAB uploads.
@@ -184,7 +192,7 @@ public BuildResult runUploadAab() {
184192

185193
private String getToken() {
186194
String token = System.getenv("FIREBASE_TOKEN");
187-
if (token == null || token.isEmpty()) {
195+
if (isNullOrEmpty(token)) {
188196
throw new IllegalStateException(
189197
"FIREBASE_TOKEN environment variable not set. This is required for production tests.");
190198
}

firebase-appdistribution-gradle/src/integrationTest/java/com/google/firebase/appdistribution/gradle/VersionUtils.kt renamed to firebase-appdistribution-gradle/src/testUtil/java/com/google/firebase/appdistribution/gradle/VersionUtils.kt

File renamed without changes.

0 commit comments

Comments
 (0)