-
Notifications
You must be signed in to change notification settings - Fork 0
303 lines (259 loc) · 10.4 KB
/
Copy pathconformance.yml
File metadata and controls
303 lines (259 loc) · 10.4 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
name: Conformance Tests
# This workflow runs conformance tests in parallel to reduce CI time
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch: # Allow manual triggering
# Set permissions for GITHUB_TOKEN
permissions:
contents: read
jobs:
# Run standard library and integration tests first (fast, basic checks)
basic-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Run standard library tests
run: cargo test --features ci --lib
- name: Run integration tests
run: cargo test --features ci --test core --test extensions --test validation --test infrastructure
# Setup test suites once for all conformance jobs
setup-test-suites:
runs-on: ubuntu-latest
steps:
- name: Cache test suites
id: cache-test-suites
uses: actions/cache@v6
with:
path: test_suites
key: ${{ runner.os }}-test-suites-${{ hashFiles('.github/workflows/conformance.yml') }}
restore-keys: |
${{ runner.os }}-test-suites-
- name: Clone 3MF test suites
run: |
if [ ! -d "test_suites" ]; then
git clone --depth 1 https://github.com/3MFConsortium/test_suites.git
fi
- name: Upload test suites artifact
uses: actions/upload-artifact@v7
with:
name: test-suites
path: test_suites/
retention-days: 1
# Run each conformance suite in parallel
conformance:
runs-on: ubuntu-latest
needs: [basic-tests, setup-test-suites]
strategy:
fail-fast: false
matrix:
suite:
# Suites 1-8 use lowercase directory names
- name: suite1_core_slice_prod
dir: suite1_core_slice_prod
pos_dir: positive_test_cases
neg_dir: negative_test_cases
- name: suite2_core_prod_matl
dir: suite2_core_prod_matl
pos_dir: positive_test_cases
neg_dir: negative_test_cases
- name: suite3_core
dir: suite3_core
pos_dir: positive_test_cases
neg_dir: negative_test_cases
- name: suite4_core_slice
dir: suite4_core_slice
pos_dir: positive_test_cases
neg_dir: negative_test_cases
- name: suite5_core_prod
dir: suite5_core_prod
pos_dir: positive_test_cases
neg_dir: negative_test_cases
- name: suite6_core_matl
dir: suite6_core_matl
pos_dir: positive_test_cases
neg_dir: negative_test_cases
- name: suite7_beam
dir: suite7_beam
pos_dir: positive_test_cases
neg_dir: negative_test_cases
- name: suite8_secure
dir: suite8_secure
pos_dir: positive_test_cases
neg_dir: negative_test_cases
# Suites 9-11 use title case with spaces (as defined in upstream test suite repo)
- name: suite9_core_ext
dir: suite9_core_ext
pos_dir: Positive Tests
neg_dir: Negative Tests
- name: suite10_boolean
dir: suite10_boolean
pos_dir: Positive Tests
neg_dir: Negative Tests
- name: suite11_displacement
dir: suite11_Displacement
pos_dir: Positive Tests
neg_dir: Negative Tests
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Prepare test_suites directory
run: mkdir -p test_suites
- name: Download test suites artifact
uses: actions/download-artifact@v8.0.1
with:
name: test-suites
path: test_suites
- name: Run conformance tests for ${{ matrix.suite.name }}
id: run-tests
run: |
echo "Testing suite: ${{ matrix.suite.name }}"
if [ "${{ matrix.suite.name }}" = "suite8_secure" ]; then
cargo test --features ci,crypto --test conformance ${{ matrix.suite.name }} -- --nocapture 2>&1 | tee test-output.txt
exit ${PIPESTATUS[0]}
else
cargo test --features ci --test conformance ${{ matrix.suite.name }} -- --nocapture 2>&1 | tee test-output.txt
exit ${PIPESTATUS[0]}
fi
- name: Generate Job Summary
if: always()
shell: bash
run: |
SUITE="${{ matrix.suite.name }}"
case "$SUITE" in
suite1_core_slice_prod) DESC="Core + Production + Slice Extensions" ;;
suite2_core_prod_matl) DESC="Core + Production + Materials Extensions" ;;
suite3_core) DESC="Core Specification (Basic)" ;;
suite4_core_slice) DESC="Core + Slice Extension" ;;
suite5_core_prod) DESC="Core + Production Extension" ;;
suite6_core_matl) DESC="Core + Materials Extension" ;;
suite7_beam) DESC="Beam Lattice Extension" ;;
suite8_secure) DESC="Secure Content Extension" ;;
suite9_core_ext) DESC="Core Extensions" ;;
suite10_boolean) DESC="Boolean Operations Extension" ;;
suite11_displacement) DESC="Displacement Extension" ;;
*) DESC="$SUITE" ;;
esac
if [ -f test-output.txt ]; then
POS_LINE=$(grep "^${SUITE}: .* positive tests" test-output.txt || true)
NEG_LINE=$(grep "^${SUITE}: .* negative tests" test-output.txt || true)
HAS_FAILURE=$(grep -cE "FAILED|failed tests" test-output.txt || true)
else
POS_LINE=""
NEG_LINE=""
HAS_FAILURE=1
fi
if [ "${HAS_FAILURE}" = "0" ]; then
STATUS="✅"
else
STATUS="❌"
fi
{
echo "## ${STATUS} ${SUITE}"
echo "*${DESC}*"
echo ""
[ -n "$POS_LINE" ] && echo "- **${POS_LINE}**"
[ -n "$NEG_LINE" ] && echo "- **${NEG_LINE}**"
if [ -f test-output.txt ] && grep -q "Failed tests:" test-output.txt; then
FAIL_COUNT=$(grep -cE "^ [0-9]+\." test-output.txt || echo "?")
echo ""
echo "<details>"
echo "<summary>❌ Failed test cases (${FAIL_COUNT})</summary>"
echo ""
echo '```'
sed -n '/Failed tests:/,/^test result:/p' test-output.txt \
| grep -v "^test result:" \
| head -100
echo '```'
echo "</details>"
fi
echo ""
} >> "$GITHUB_STEP_SUMMARY"
# Generate overall summary after all suites complete
conformance-summary:
runs-on: ubuntu-latest
needs: [conformance, setup-test-suites]
if: always()
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Prepare directories
run: mkdir -p test_suites suite-reports
- name: Download test suites artifact
uses: actions/download-artifact@v8.0.1
with:
name: test-suites
path: test_suites
- name: Generate overall conformance summary
run: |
echo "# Conformance Test Results" > conformance-summary.md
echo "" >> conformance-summary.md
echo "## Overall Summary" >> conformance-summary.md
echo "Tests were run in parallel in the conformance job. See individual suite reports below." >> conformance-summary.md
continue-on-error: true
- name: Download all suite reports
uses: actions/download-artifact@v8.0.1
with:
pattern: conformance-report-*
path: suite-reports
- name: Generate CONFORMANCE_REPORT.md
run: |
echo "Generating basic conformance report..."
TIMESTAMP=$(date -u '+%Y-%m-%d %H:%M:%S UTC')
cat > CONFORMANCE_REPORT.md << 'EOFMARKER'
# 3MF Conformance Test Report
**Generated:** TIMESTAMP_PLACEHOLDER
## Test Execution
Conformance tests were executed in parallel across 11 test suites.
See individual suite reports in the GitHub Actions artifacts for detailed results.
## Test Suites
The following test suites were executed:
- suite1_core_slice_prod: Core + Production + Slice Extensions
- suite2_core_prod_matl: Core + Production + Materials Extensions
- suite3_core: Core Specification (Basic)
- suite4_core_slice: Core + Slice Extension
- suite5_core_prod: Core + Production Extension
- suite6_core_matl: Core + Materials Extension
- suite7_beam: Beam Lattice Extension
- suite8_secure: Secure Content Extension
- suite9_core_ext: Core Extensions
- suite10_boolean: Boolean Operations Extension
- suite11_Displacement: Displacement Extension
---
## About This Report
This report is automatically generated by the CI workflow.
Tests are run against the official 3MF Consortium test cases from [3MFConsortium/test_suites](https://github.com/3MFConsortium/test_suites).
**Test Methodology:**
- **Positive tests** validate that valid 3MF files parse successfully
- **Negative tests** validate that invalid 3MF files are properly rejected
**To generate a detailed report locally:**
```bash
./generate_conformance_report.sh
```
EOFMARKER
sed -i "s/TIMESTAMP_PLACEHOLDER/$TIMESTAMP/" CONFORMANCE_REPORT.md
echo "✅ Basic conformance report generated"
- name: Upload combined conformance report
uses: actions/upload-artifact@v7
with:
name: conformance-report-combined
path: |
conformance-summary.md
suite-reports/
CONFORMANCE_REPORT.md
retention-days: 30