chore(workflow): fix: provide dummy version name for test jobs

This commit is contained in:
Akash Yadav
2023-04-13 00:28:53 +05:30
parent 770525c07d
commit 5b11be618a
3 changed files with 17 additions and 6 deletions
+2
View File
@@ -110,6 +110,7 @@ jobs:
- name: Run debug tests
run: ./gradlew testDebug --continue
env:
ANDROIDIDE_TEST: true
IDE_SIGNING_ALIAS: ${{ secrets.IDE_SIGNING_ALIAS }}
IDE_SIGNING_AUTH_PASS: ${{ secrets.IDE_SIGNING_AUTH_PASS }}
IDE_SIGNING_AUTH_USER: ${{ secrets.IDE_SIGNING_AUTH_USER }}
@@ -148,6 +149,7 @@ jobs:
- name: Run Tooling API tests
run: ./gradlew clean :subprojects:tooling-api-impl:build
env:
ANDROIDIDE_TEST: true
TEST_TOOLING_API_IMPL: "true"
IDE_SIGNING_ALIAS: ${{ secrets.IDE_SIGNING_ALIAS }}
IDE_SIGNING_AUTH_PASS: ${{ secrets.IDE_SIGNING_AUTH_PASS }}
+4 -1
View File
@@ -15,8 +15,8 @@
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
import org.gradle.kotlin.dsl.provideDelegate
import java.io.File
import org.gradle.kotlin.dsl.provideDelegate
/**
* Information about the CI build.
@@ -39,6 +39,9 @@ object CI {
/** Whether the current build is a CI build. */
val isCiBuild by lazy { "true" == System.getenv("CI") }
/** Whether the current build is for tests. This is set ONLY in CI builds. */
val isTestEnv by lazy { "true" == System.getenv("ANDROIDIDE_TEST") }
private fun shortSha(sha: String): String {
return ProcessBuilder("git", "rev-parse", "--short", sha)
.directory(File("."))
+10 -4
View File
@@ -51,9 +51,15 @@ val Project.simpleVersionName: String by lazy {
return@lazy regex.find(version)?.value?.substring(1)?.also {
logger.warn("Simple version name is '$it' (from version $version)")
}
?: throw IllegalStateException(
"Invalid version string '$version'. Version names must be SEMVER with 'v' prefix"
)
?: run {
if (CI.isTestEnv) {
return@run "1.0.0-beta"
}
throw IllegalStateException(
"Cannot extract simple version name. Invalid version string '$version'. Version names must be SEMVER with 'v' prefix"
)
}
}
val Project.projectVersionCode: Int by lazy {
@@ -64,7 +70,7 @@ val Project.projectVersionCode: Int by lazy {
logger.warn("Version code is '$it' (from version ${version}).")
}
?: throw IllegalStateException(
"Invalid version string '$version'. Version names must be SEMVER with 'v' prefix"
"Cannot extract version code. Invalid version string '$version'. Version names must be SEMVER with 'v' prefix"
)
}