-
Notifications
You must be signed in to change notification settings - Fork 22
/
build.gradle
70 lines (56 loc) · 2.99 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
plugins {
id 'org.springframework.boot' version '3.3.4'
id 'io.spring.dependency-management' version '1.1.6'
id 'java'
id "au.com.dius.pact" version "4.5.13"
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
java {
sourceCompatibility = '17'
}
repositories {
mavenCentral()
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
testImplementation 'au.com.dius.pact.provider:junit:4.5.13'
testImplementation 'au.com.dius.pact.provider:junit5:4.5.13'
testImplementation 'au.com.dius.pact.provider:spring6:4.5.13'
runtimeOnly 'com.h2database:h2'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform()
// These properties need to be set on the test JVM process
//https://docs.pact.io/implementation_guides/jvm/provider/junit#using-java-system-properties
// required variables for fetching dynamic pacts, & publishing verification results
systemProperty("pact.provider.version", System.getenv("GIT_COMMIT") == null ? "" : System.getenv("GIT_COMMIT"))
systemProperty("pact.provider.branch", System.getenv("GIT_BRANCH") == null ? "" : System.getenv("GIT_BRANCH"))
// only publish verification results from CI allowing developers to run tests locally and debug, without affecting broker results
// only verification results from a known source (such at a commit in a VCS and a reproducible environment such as CI) should be published
systemProperty("pact.verifier.publishResults", System.getenv("PACT_BROKER_PUBLISH_VERIFICATION_RESULTS") == null ? "false" : "true")
// Consumer version selectors for dynamically fetching pacts
// https://docs.pact.io/implementation_guides/jvm/provider/junit#selecting-the-pacts-to-verify-with-consumer-version-selectors-4314
// Runs when the provider code changes
systemProperty("pactbroker.consumerversionselectors.rawjson", "[{\"mainBranch\":true},{\"deployedOrReleased\":true},{\"matchingBranch\":true}]")
// Allow just the changed pact triggered by webhook, to be verified, ignoring the consumer version selectors above
// https://docs.pact.io/implementation_guides/jvm/provider/junit#allowing-just-the-changed-pact-specified-in-a-webhook-to-be-verified-406
// Runs when the consumer contract changes
systemProperty("pact.filter.pacturl", System.getenv("PACT_URL") == null ? null : System.getenv("PACT_URL"))
systemProperty("pact.filter.consumers", System.getenv("PACT_URL") == null ? null : System.getenv("PACT_URL").split("/consumer/")[1])
// pending pacts
systemProperty("pactbroker.enablePending", true)
// work in progress pacts
systemProperty("pactbroker.includeWipPactsSince", java.time.LocalDate.now().minusMonths(6).format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd")))
}