Skip to content

Commit 8eb53b5

Browse files
committed
Merge branch 'wangbill/test-fix' of https://github.com/microsoft/durabletask-java into wangbill/test-fix
2 parents 2e93482 + 4c3e502 commit 8eb53b5

File tree

10 files changed

+786
-18
lines changed

10 files changed

+786
-18
lines changed

.github/workflows/build-validation.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ jobs:
2020

2121
steps:
2222
- uses: actions/checkout@v2
23-
with:
24-
submodules: true
2523

2624
- name: Set up JDK 11
2725
uses: actions/setup-java@v2
@@ -59,13 +57,13 @@ jobs:
5957
continue-on-error: false
6058

6159
- name: Archive test report
62-
uses: actions/upload-artifact@v2
60+
uses: actions/upload-artifact@v4
6361
with:
6462
name: Integration test report
6563
path: client/build/reports/tests/integrationTest
6664

6765
- name: Upload JAR output
68-
uses: actions/upload-artifact@v2
66+
uses: actions/upload-artifact@v4
6967
with:
7068
name: Package
7169
path: client/build/libs
@@ -77,8 +75,6 @@ jobs:
7775

7876
steps:
7977
- uses: actions/checkout@v2
80-
with:
81-
submodules: true
8278

8379
- name: Set up JDK 8
8480
uses: actions/setup-java@v2
@@ -90,7 +86,7 @@ jobs:
9086
uses: gradle/gradle-build-action@v2
9187

9288
- name: Publish to local
93-
run: ./gradlew publishToMavenLocal -x sign
89+
run: ./gradlew publishToMavenLocal
9490

9591
- name: Build azure functions sample
9692
run: ./gradlew azureFunctionsPackage
@@ -106,7 +102,7 @@ jobs:
106102
arguments: endToEndTest
107103

108104
- name: Archive test report
109-
uses: actions/upload-artifact@v2
105+
uses: actions/upload-artifact@v4
110106
with:
111107
name: Integration test report
112108
path: client/build/reports/tests/endToEndTest
@@ -118,8 +114,6 @@ jobs:
118114

119115
steps:
120116
- uses: actions/checkout@v2
121-
with:
122-
submodules: true
123117

124118
- name: Set up JDK 8
125119
uses: actions/setup-java@v2
@@ -147,7 +141,7 @@ jobs:
147141
arguments: sampleTest
148142

149143
- name: Archive test report
150-
uses: actions/upload-artifact@v2
144+
uses: actions/upload-artifact@v4
151145
with:
152146
name: Integration test report
153147
path: client/build/reports/tests/endToEndTest

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## placeholder
2+
* Add automatic proto file download and commit hash tracking during build ([#207](https://github.com/microsoft/durabletask-java/pull/207))
23
* Fix infinite loop when use continueasnew after wait external event ([#183](https://github.com/microsoft/durabletask-java/pull/183))
34
* Fix the issue "Deserialize Exception got swallowed when use anyOf with external event." ([#185](https://github.com/microsoft/durabletask-java/pull/185))
45

azdevops-pipeline/build-release-artifacts.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ pool:
1010

1111
steps:
1212
- checkout: self
13-
submodules: true
1413

1514
- task: Gradle@3
1615
inputs:

client/build.gradle

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,44 @@ compileTestJava {
4949
options.forkOptions.executable = "${PATH_TO_TEST_JAVA_RUNTIME}/bin/javac"
5050
}
5151

52+
task downloadProtoFiles {
53+
ext.branch = project.hasProperty('protoBranch') ? project.protoBranch : 'main'
54+
55+
doLast {
56+
def protoDir = file("${rootProject.projectDir}/internal/durabletask-protobuf/protos")
57+
protoDir.mkdirs()
58+
59+
// Download the proto file
60+
new URL("https://raw.githubusercontent.com/microsoft/durabletask-protobuf/${ext.branch}/protos/orchestrator_service.proto")
61+
.withInputStream { i ->
62+
new File(protoDir, 'orchestrator_service.proto').withOutputStream { it << i }
63+
}
64+
65+
// Get and save the commit hash
66+
def commitHashFile = new File("${rootProject.projectDir}/internal/durabletask-protobuf/PROTO_SOURCE_COMMIT_HASH")
67+
def commitApiUrl = new URL("https://api.github.com/repos/microsoft/durabletask-protobuf/commits?path=protos/orchestrator_service.proto&sha=${ext.branch}&per_page=1")
68+
def connection = commitApiUrl.openConnection()
69+
connection.setRequestProperty('Accept', 'application/vnd.github.v3+json')
70+
def commitHash = new groovy.json.JsonSlurper().parse(connection.inputStream)[0].sha
71+
commitHashFile.text = commitHash
72+
}
73+
}
74+
5275
protobuf {
5376
protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
5477
plugins {
5578
grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
5679
}
5780
generateProtoTasks {
5881
all()*.plugins { grpc {} }
82+
all()*.dependsOn downloadProtoFiles
5983
}
6084
}
6185

6286
sourceSets {
6387
main {
6488
proto {
65-
srcDir '../submodules/durabletask-protobuf/protos'
89+
srcDir '../internal/durabletask-protobuf/protos'
6690
}
6791
java {
6892
srcDirs 'build/generated/source/proto/main/grpc'

eng/templates/build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ jobs:
1111

1212
steps:
1313
- checkout: self
14-
submodules: true
1514

1615
- task: Gradle@3
1716
inputs:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4792f47019ab2b3e9ea979fb4af72427a4144c51
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Durable Task Protobuf Files
2+
3+
This directory contains the protocol buffer definitions used by the Durable Task Framework Java SDK. The files in this directory are automatically downloaded and updated during the build process from the [microsoft/durabletask-protobuf](https://github.com/microsoft/durabletask-protobuf) repository.
4+
5+
## Directory Structure
6+
7+
- `protos/` - Contains the downloaded proto files
8+
- `PROTO_SOURCE_COMMIT_HASH` - Contains the commit hash of the latest proto file version
9+
10+
## Auto-Update Process
11+
12+
The proto files are automatically downloaded and updated when running Gradle builds. This is handled by the `downloadProtoFiles` task in the `client/build.gradle` file. The task:
13+
14+
1. Downloads the latest version of `orchestrator_service.proto`
15+
2. Saves the current commit hash for tracking purposes
16+
3. Updates these files before proto compilation begins
17+
18+
## Manual Update
19+
20+
If you need to manually update the proto files, you can run:
21+
22+
```bash
23+
./gradlew downloadProtoFiles -PprotoBranch=<branch-name>
24+
```

0 commit comments

Comments
 (0)