forked from Tinry1/arcane
-
Notifications
You must be signed in to change notification settings - Fork 0
214 lines (185 loc) · 6.57 KB
/
Copy pathbuild-test-debug.yml
File metadata and controls
214 lines (185 loc) · 6.57 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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: Build & Test Debug
# Cancel older jobs on PRs when new changes are pushed
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
on:
push:
branches: [ master, staging, stable, Starlight, starlight-dev, upstream-devtest, fix/tests, arcane, arcane-dev ]
merge_group:
pull_request:
types: [ opened, reopened, synchronize, ready_for_review ]
branches: [ master, staging, stable, Starlight, starlight-dev, upstream-devtest, arcane, arcane-dev ]
jobs:
build:
if: github.actor != 'PJBot' && github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout Master
uses: actions/checkout@v4.2.2
- name: Setup Submodule
run: |
git submodule update --init --recursive
- name: Pull engine updates
uses: space-wizards/submodule-dependency@v0.1.5
- name: Update Engine Submodules
run: |
cd RobustToolbox/
git submodule update --init --recursive
- name: Setup .NET Core
uses: actions/setup-dotnet@v4.1.0
with:
dotnet-version: 10.0.x
- name: Install dependencies
run: dotnet restore
- name: Build Project
run: dotnet build --configuration DebugOpt --no-restore /m
- name: Discover Integration Tests
run: |
dotnet test --list-tests --no-build --configuration DebugOpt Content.IntegrationTests/Content.IntegrationTests.csproj 2>&1 | \
python3 Tools/_Starlight/partition_tests.py generate 8 .integration-filters
- name: Archive build output
run: tar czf /tmp/build.tar.gz --exclude='.git' .
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: build-output
path: /tmp/build.tar.gz
retention-days: 1
compression-level: 0
content-tests:
needs: build
name: Content Tests
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Setup .NET Core
uses: actions/setup-dotnet@v4.1.0
with:
dotnet-version: 10.0.x
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build-output
- name: Extract build
run: tar xzf build.tar.gz && rm build.tar.gz
- name: Restore packages
run: dotnet restore Content.Tests/Content.Tests.csproj
- name: Run Content.Tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 15
max_attempts: 2
command: dotnet test --no-build --configuration DebugOpt Content.Tests/Content.Tests.csproj --logger "trx;LogFileName=results.trx" --results-directory /tmp/test-results
- name: Test results
continue-on-error: true
if: always()
run: |
dotnet tool install -g dotnet-trx 2>/dev/null || true
mkdir -p /tmp/test-results
trx --path /tmp/test-results -o -v verbose || true
integration-tests:
needs: build
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4, 5, 6, 7]
name: "Integration Tests (shard ${{ matrix.shard }})"
runs-on: ubuntu-latest
steps:
- name: Setup .NET Core
uses: actions/setup-dotnet@v4.1.0
with:
dotnet-version: 10.0.x
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build-output
- name: Extract build
run: tar xzf build.tar.gz && rm build.tar.gz
- name: Restore packages
run: dotnet restore Content.IntegrationTests/Content.IntegrationTests.csproj
- name: Run Content.IntegrationTests
uses: nick-fields/retry@v3
env:
DOTNET_gcServer: "1"
with:
timeout_minutes: 17
max_attempts: 2
retry_on: any
command: |
RUNSETTINGS=".integration-filters/shard_${{ matrix.shard }}.runsettings"
if [ ! -f "$RUNSETTINGS" ]; then
echo "No tests assigned to shard ${{ matrix.shard }}"
exit 0
fi
timeout --signal=TERM --kill-after=2m 15m \
dotnet test --no-build --configuration DebugOpt Content.IntegrationTests/Content.IntegrationTests.csproj --logger "trx;LogFileName=results.trx" --logger "console;verbosity=normal" --results-directory /tmp/test-results --blame-hang --blame-hang-timeout 3min --settings "$RUNSETTINGS"
- name: Test results
continue-on-error: true
if: always()
run: |
dotnet tool install -g dotnet-trx 2>/dev/null || true
mkdir -p /tmp/test-results
trx --path /tmp/test-results -o -v verbose || true
- name: Upload crash dumps
id: upload-dumps
uses: actions/upload-artifact@v4
if: always()
with:
name: blame-dump-shard-${{ matrix.shard }}
path: |
/tmp/test-results/**/*.dmp
/tmp/test-results/**/*Sequence*.xml
retention-days: 3
if-no-files-found: ignore
- name: Report hung tests
continue-on-error: true
if: always()
run: |
shopt -s nullglob globstar
found=false
for seq in /tmp/test-results/**/*Sequence*.xml; do
if [ "$found" = false ]; then
echo "## :warning: Hung tests detected (shard ${{ matrix.shard }})" >> "$GITHUB_STEP_SUMMARY"
echo '```xml' >> "$GITHUB_STEP_SUMMARY"
found=true
fi
cat "$seq" >> "$GITHUB_STEP_SUMMARY"
done
if [ "$found" = true ]; then
echo '```' >> "$GITHUB_STEP_SUMMARY"
if [ -n "${{ steps.upload-dumps.outputs.artifact-url }}" ]; then
echo ":floppy_disk: [Download crash dump](${{ steps.upload-dumps.outputs.artifact-url }})" >> "$GITHUB_STEP_SUMMARY"
fi
fi
ci-success:
name: Debug CI Required
if: ${{ always() }}
needs:
- build
- content-tests
- integration-tests
runs-on: ubuntu-latest
steps:
- name: Fail if any dependency was not successful
if: ${{ needs.build.result != 'success' || needs['content-tests'].result != 'success' || needs['integration-tests'].result != 'success' }}
run: |
echo "build=${{ needs.build.result }}"
echo "content-tests=${{ needs['content-tests'].result }}"
echo "integration-tests=${{ needs['integration-tests'].result }}"
exit 1
- name: CI succeeded
run: exit 0
cleanup:
name: Cleanup Artifacts
needs:
- content-tests
- integration-tests
if: always()
runs-on: ubuntu-latest
steps:
- name: Delete build artifact
uses: geekyeggo/delete-artifact@v5
with:
name: build-output