Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Validate Maven version on publish #1949

Merged
merged 2 commits into from
May 24, 2021

Conversation

piotradamczyk5
Copy link
Contributor

@piotradamczyk5 piotradamczyk5 commented May 19, 2021

Fixes #1839

Composite build Gradle plugin to validate maven version

Test Plan

How do we know the code works?

Gradle publication failed when a bad version provided

Testing locally

  1. Comment signing block (because we do not have signing keys stored locally) in file test_runner/build.gradle.kts
/*signing {
  val pgpSigningKey: String = System.getenv("PGP_SIGNING_KEY") ?: properties["PGP_SIGNING_KEY"].toString()
  useInMemoryPgpKeys(pgpSigningKey, "")
  sign(publishing.publications["mavenJava"])
}*/
  1. Replace PublishToMavenRepository with PublishToMavenLocal (because we would like to just test it locally) in file maven_version_check/src/main/kotlin/MavenVersionCheck.kt
  2. Run ./gradlew publishToMavenLocal
  3. There should not be any error
  4. Replace local-SNAPSHOT version with bad one(examples could be found in maven_version_check/src/test/kotlin/MavenVersionCheckTest.kt) in file test_runner/build.gradle.kts
  5. Run ./gradlew publishToMavenLocal
  6. Check that build error is printed
  7. Play with other version and check the results

run ./gradlew :maven_version_check:test to run unit tests

Checklist

  • Unit tested

@github-actions
Copy link
Contributor

github-actions bot commented May 19, 2021

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@github-actions
Copy link
Contributor

github-actions bot commented May 19, 2021

Timestamp: 2021-05-24 09:13:30
Buildscan url for ubuntu-workflow run 870854736
https://gradle.com/s/mhbvuf4xfllta

@piotradamczyk5 piotradamczyk5 marked this pull request as ready for review May 21, 2021 14:49
@bootstraponline bootstraponline force-pushed the 1839_validate_publish_version branch from 62fa868 to 1268e03 Compare May 21, 2021 15:01
@bootstraponline bootstraponline force-pushed the 1839_validate_publish_version branch from 1268e03 to 7882216 Compare May 21, 2021 15:57
@piotradamczyk5 piotradamczyk5 changed the title ci: Validate Gradle version on publish ci: Validate Maven version on publish May 21, 2021
@piotradamczyk5 piotradamczyk5 enabled auto-merge (squash) May 21, 2021 17:20
@bootstraponline bootstraponline force-pushed the 1839_validate_publish_version branch from 7882216 to 5cc2b98 Compare May 24, 2021 08:54
@bootstraponline bootstraponline force-pushed the 1839_validate_publish_version branch from 5cc2b98 to e70e131 Compare May 24, 2021 09:07
@piotradamczyk5 piotradamczyk5 merged commit 32244bf into master May 24, 2021
@piotradamczyk5 piotradamczyk5 deleted the 1839_validate_publish_version branch May 24, 2021 12:24
@github-actions github-actions bot locked and limited conversation to collaborators May 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fail publish process when version number is not correct
3 participants