-
Notifications
You must be signed in to change notification settings - Fork 14
192 lines (148 loc) · 5.5 KB
/
build-validation.yml
File metadata and controls
192 lines (148 loc) · 5.5 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Build Validation
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'microsoft'
- name: set JDK_11 environment variable test compiling and running
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: echo ::set-env name=JDK_11::$(echo $JAVA_HOME)
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build with Gradle
run: ./gradlew build -x test
- name: Run SpotBugs
run: ./gradlew spotbugsMain spotbugsTest
continue-on-error: false
- name: Upload SpotBugs reports
uses: actions/upload-artifact@v4
with:
name: SpotBugs Reports
path: '**/build/reports/spotbugs'
if-no-files-found: ignore
- name: Run Unit Tests with Gradle
run: |
export JAVA_HOME=$JDK_11
./gradlew clean test || echo "UNIT_TEST_FAILED=true" >> $GITHUB_ENV
continue-on-error: true
- name: Upload test reports if tests failed
if: env.UNIT_TEST_FAILED == 'true'
uses: actions/upload-artifact@v4
with:
name: Unit Test Reports
path: '**/build/reports/tests/test'
if-no-files-found: ignore # Prevents errors if no reports exist
- name: Fail the job if unit tests failed
if: env.UNIT_TEST_FAILED == 'true'
run: exit 1
# TODO: Move the sidecar into a central image repository
- name: Initialize Durable Task Sidecar
run: docker run --name durabletask-sidecar -p 4001:4001 --env 'DURABLETASK_SIDECAR_LOGLEVEL=Debug' -d peterstone2019/durabletask-sidecar:latest start --backend Emulator
- name: Display Durable Task Sidecar Logs
run: nohup docker logs --since=0 durabletask-sidecar > durabletask-sidecar.log 2>&1 &
# 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
- name: Wait for 10 seconds
run: sleep 10
- name: Integration Tests with Gradle
run: ./gradlew integrationTest || echo "TEST_FAILED=true" >> $GITHUB_ENV
continue-on-error: true
- name: Kill Durable Task Sidecar
run: docker kill durabletask-sidecar
- name: Upload Durable Task Sidecar Logs
uses: actions/upload-artifact@v4
with:
name: Durable Task Sidecar Logs
path: durabletask-sidecar.log
- name: Archive test report
uses: actions/upload-artifact@v4
with:
name: Integration test report
path: client/build/reports/tests/integrationTest
- name: Upload JAR output
uses: actions/upload-artifact@v4
with:
name: Package
path: client/build/libs
- name: Fail the job if tests failed
if: env.TEST_FAILED == 'true'
run: exit 1
functions-e2e-tests:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Publish to local
run: ./gradlew publishToMavenLocal -PskipSigning
- name: Build azure functions sample
run: ./gradlew azureFunctionsPackage
continue-on-error: true
- name: Setup azure functions runtime
run: endtoendtests/e2e-test-setup.ps1 -DockerfilePath endtoendtests/Dockerfile
shell: pwsh
- name: End to End Tests with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: endToEndTest
- name: Archive test report
uses: actions/upload-artifact@v4
with:
name: Integration test report
path: client/build/reports/tests/endToEndTest
functions-sample-tests:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Publish to local
run: ./gradlew publishToMavenLocal -PskipSigning
- name: Build azure functions sample
run: ./gradlew azureFunctionsPackage
continue-on-error: true
- name: Setup azure functions runtime
run: samples-azure-functions/e2e-test-setup.ps1 -DockerfilePath samples-azure-functions/Dockerfile
shell: pwsh
- name: Sample Tests with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: sampleTest
- name: Archive test report
uses: actions/upload-artifact@v4
with:
name: Integration test report
path: client/build/reports/tests/endToEndTest