Skip to content

Commit aa20d80

Browse files
committed
update action
Signed-off-by: salaboy <[email protected]>
1 parent 92d9e78 commit aa20d80

File tree

1 file changed

+97
-57
lines changed

1 file changed

+97
-57
lines changed

.github/workflows/build-validation.yml

Lines changed: 97 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -19,55 +19,99 @@ jobs:
1919
runs-on: ubuntu-latest
2020

2121
steps:
22-
- uses: actions/checkout@v2
23-
with:
24-
submodules: true
25-
26-
- name: Set up JDK 11
27-
uses: actions/setup-java@v2
28-
with:
29-
java-version: '11'
30-
distribution: 'microsoft'
31-
32-
- name: set JDK_11 environment variable test compiling and running
33-
env:
34-
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
35-
run: echo ::set-env name=JDK_11::$(echo $JAVA_HOME)
36-
37-
- name: Set up JDK 8
38-
uses: actions/setup-java@v2
39-
with:
40-
java-version: '8'
41-
distribution: 'temurin'
42-
43-
- name: Setup Gradle
44-
uses: gradle/gradle-build-action@v2
45-
46-
- name: Build with Gradle
47-
run: ./gradlew build
48-
49-
# TODO: Move the sidecar into a central image repository
50-
- name: Initialize Durable Task Sidecar
51-
run: docker run --name durabletask-sidecar -p 4001:4001 --env 'DURABLETASK_SIDECAR_LOGLEVEL=Debug' -d kaibocai/durabletask-sidecar:latest start --backend Emulator
52-
53-
# wait for 10 seconds, so sidecar container can be fully up, this will avoid intermittent failing issues for integration tests causing by failed to connect to sidecar
54-
- name: Wait for 10 seconds
55-
run: sleep 10
56-
57-
- name: Integration Tests with Gradle
58-
run: ./gradlew integrationTest
59-
60-
- name: Archive test report
61-
uses: actions/upload-artifact@v2
62-
with:
63-
name: Integration test report
64-
path: client/build/reports/tests/integrationTest
65-
66-
- name: Upload JAR output
67-
uses: actions/upload-artifact@v2
68-
with:
69-
name: Package
70-
path: client/build/libs
22+
- uses: actions/checkout@v2
23+
24+
- name: Set up JDK 11
25+
uses: actions/setup-java@v2
26+
with:
27+
java-version: '11'
28+
distribution: 'microsoft'
29+
30+
- name: set JDK_11 environment variable test compiling and running
31+
env:
32+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
33+
run: echo ::set-env name=JDK_11::$(echo $JAVA_HOME)
34+
35+
- name: Set up JDK 8
36+
uses: actions/setup-java@v2
37+
with:
38+
java-version: '8'
39+
distribution: 'temurin'
40+
41+
- name: Setup Gradle
42+
uses: gradle/gradle-build-action@v2
43+
44+
- name: Build with Gradle
45+
run: ./gradlew build -x test
46+
47+
- name: Run SpotBugs
48+
run: ./gradlew spotbugsMain spotbugsTest
49+
continue-on-error: false
50+
51+
- name: Upload SpotBugs reports
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: SpotBugs Reports
55+
path: '**/build/reports/spotbugs'
56+
if-no-files-found: ignore
57+
58+
- name: Run Unit Tests with Gradle
59+
run: |
60+
export JAVA_HOME=$JDK_11
61+
./gradlew clean test || echo "UNIT_TEST_FAILED=true" >> $GITHUB_ENV
62+
continue-on-error: true
63+
64+
- name: Upload test reports if tests failed
65+
if: env.UNIT_TEST_FAILED == 'true'
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: Unit Test Reports
69+
path: '**/build/reports/tests/test'
70+
if-no-files-found: ignore # Prevents errors if no reports exist
71+
72+
- name: Fail the job if unit tests failed
73+
if: env.UNIT_TEST_FAILED == 'true'
74+
run: exit 1
75+
76+
# TODO: Move the sidecar into a central image repository
77+
- name: Initialize Durable Task Sidecar
78+
run: docker run --name durabletask-sidecar -p 4001:4001 --env 'DURABLETASK_SIDECAR_LOGLEVEL=Debug' -d peterstone2019/durabletask-sidecar:latest start --backend Emulator
79+
80+
- name: Display Durable Task Sidecar Logs
81+
run: nohup docker logs --since=0 durabletask-sidecar > durabletask-sidecar.log 2>&1 &
82+
83+
# wait for 10 seconds, so sidecar container can be fully up, this will avoid intermittent failing issues for integration tests causing by failed to connect to sidecar
84+
- name: Wait for 10 seconds
85+
run: sleep 10
86+
87+
- name: Integration Tests with Gradle
88+
run: ./gradlew integrationTest || echo "TEST_FAILED=true" >> $GITHUB_ENV
89+
continue-on-error: true
90+
91+
- name: Kill Durable Task Sidecar
92+
run: docker kill durabletask-sidecar
93+
94+
- name: Upload Durable Task Sidecar Logs
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: Durable Task Sidecar Logs
98+
path: durabletask-sidecar.log
99+
100+
- name: Archive test report
101+
uses: actions/upload-artifact@v4
102+
with:
103+
name: Integration test report
104+
path: client/build/reports/tests/integrationTest
105+
106+
- name: Upload JAR output
107+
uses: actions/upload-artifact@v4
108+
with:
109+
name: Package
110+
path: client/build/libs
111+
112+
- name: Fail the job if tests failed
113+
if: env.TEST_FAILED == 'true'
114+
run: exit 1
71115

72116
functions-e2e-tests:
73117

@@ -76,8 +120,6 @@ jobs:
76120

77121
steps:
78122
- uses: actions/checkout@v2
79-
with:
80-
submodules: true
81123

82124
- name: Set up JDK 8
83125
uses: actions/setup-java@v2
@@ -89,7 +131,7 @@ jobs:
89131
uses: gradle/gradle-build-action@v2
90132

91133
- name: Publish to local
92-
run: ./gradlew publishToMavenLocal -x sign
134+
run: ./gradlew publishToMavenLocal -PskipSigning
93135

94136
- name: Build azure functions sample
95137
run: ./gradlew azureFunctionsPackage
@@ -105,7 +147,7 @@ jobs:
105147
arguments: endToEndTest
106148

107149
- name: Archive test report
108-
uses: actions/upload-artifact@v2
150+
uses: actions/upload-artifact@v4
109151
with:
110152
name: Integration test report
111153
path: client/build/reports/tests/endToEndTest
@@ -117,8 +159,6 @@ jobs:
117159

118160
steps:
119161
- uses: actions/checkout@v2
120-
with:
121-
submodules: true
122162

123163
- name: Set up JDK 8
124164
uses: actions/setup-java@v2
@@ -130,7 +170,7 @@ jobs:
130170
uses: gradle/gradle-build-action@v2
131171

132172
- name: Publish to local
133-
run: ./gradlew publishToMavenLocal -x sign
173+
run: ./gradlew publishToMavenLocal -PskipSigning
134174

135175
- name: Build azure functions sample
136176
run: ./gradlew azureFunctionsPackage
@@ -146,7 +186,7 @@ jobs:
146186
arguments: sampleTest
147187

148188
- name: Archive test report
149-
uses: actions/upload-artifact@v2
189+
uses: actions/upload-artifact@v4
150190
with:
151191
name: Integration test report
152192
path: client/build/reports/tests/endToEndTest

0 commit comments

Comments
 (0)