Run Steps in Parallel and in Sequence
By default, a job runs steps sequentially one after another. To run them in parallel, use the parallel
statement. To run steps sequentially inside the parallel
block, use sequential
:
job("Build and run tests") {
container(displayName = "Run build", image = "gradle:6.1.1-jre11") {
kotlinScript { api ->
api.gradle("build", "-x", "test")
}
}
parallel {
container(displayName = "Run main tests", image = "gradle:6.1.1-jre11") {
kotlinScript { api ->
api.gradle("mainTests")
}
}
sequential {
container(displayName = "Prepare test data", image = "gradle:6.1.1-jre11") {
kotlinScript { api ->
api.gradle("generateTestData")
}
}
container(displayName = "Run int tests", image = "gradle:6.1.1-jre11") {
kotlinScript { api ->
api.gradle("integrationTests")
}
}
}
}
}
Last modified: 15 December 2023