Let’s say I have a build pipeline with 2 stages:
Stage 1 runs unit tests and uploads to my repository
Stage 2 runs integration tests (located in the same project)
If I define an integTest configuration and sourceSet, Stage 2 will do a lot of the work from Stage 1 again.
Instead I would like to download the artifact that was built in Stage 1 and replace all references to the local source code with that artifact. That would also make sure that what I’m testing is exactly what I’m eventually gonna ship. The build script would look something like this:
if (project.hasProperty("testedVersion") {
//don't use locally built classes
sourceSets.integTest.compileClasspath -= sourceSets.main.output
//use prebuilt artifact instead
dependencies {
integTest "${project.group}:${project.name}:${testedVersion}"
}
}
But this will not fetch the remote artifact, but just use the locally built classes instead. I also tried using the new dependency substitution feature, but that only seems to work for upstream projects, not for the current project itself.
Any best practices on how to solve this?