1919env :
2020 CARGO_TERM_COLOR : always
2121 RUST_BACKTRACE : 1
22+ ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION : true
2223
2324jobs :
2425 build-and-test :
2728
2829 steps :
2930 - name : Checkout rustVX
30- uses : actions/checkout@v4
31+ uses : actions/checkout@v3
32+ with :
33+ fetch-depth : 0
3134
3235 - name : Install system dependencies
3336 run : |
@@ -41,28 +44,47 @@ jobs:
4144 python3 \
4245 python3-pip
4346
44- - name : Setup Rust toolchain
45- uses : actions-rust-lang/setup-rust-toolchain@v1
47+ - name : Install Rust
48+ run : |
49+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
50+ source $HOME/.cargo/env
51+ rustc --version
52+ cargo --version
53+
54+ - name : Cache Cargo registry
55+ uses : actions/cache@v3
4656 with :
47- toolchain : stable
48- components : rustfmt, clippy
57+ path : ~/.cargo/registry
58+ key : ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
59+ restore-keys : |
60+ ${{ runner.os }}-cargo-registry-
4961
50- - name : Cache Rust dependencies
51- uses : Swatinem/rust- cache@v2
62+ - name : Cache Cargo index
63+ uses : actions/ cache@v3
5264 with :
53- key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
54- shared-key : " openvx-build"
65+ path : ~/.cargo/git
66+ key : ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
67+ restore-keys : |
68+ ${{ runner.os }}-cargo-index-
69+
70+ - name : Cache Cargo build
71+ uses : actions/cache@v3
72+ with :
73+ path : target
74+ key : ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
75+ restore-keys : |
76+ ${{ runner.os }}-cargo-build-target-
5577
5678 - name : Cache OpenVX CTS build
5779 id : cache-cts
58- uses : actions/cache@v4
80+ uses : actions/cache@v3
5981 with :
60- path : |
61- OpenVX-cts/build
82+ path : OpenVX-cts/build
6283 key : ${{ runner.os }}-cts-${{ hashFiles('OpenVX-cts/CMakeLists.txt') }}
6384
6485 - name : Build rustVX
6586 run : |
87+ source $HOME/.cargo/env
6688 echo "Building rustVX..."
6789 cargo build --release
6890 echo "Build complete. Library files:"
7799 cd build
78100 cmake .. \
79101 -DCMAKE_BUILD_TYPE=Release \
80- -DOpenVX_SOURCE_DIR=../openvx \
81102 -G Ninja
82- ninja -j$(nproc)
103+ ninja -j$(nproc) || make -j$(nproc)
83104 echo "CTS build complete."
84105
85106 - name : Prepare test environment
92113 id : run_tests
93114 continue-on-error : true
94115 run : |
116+ source $HOME/.cargo/env
95117 echo "========================================"
96118 echo "Running OpenVX Vision Conformance Tests"
97119 echo "========================================"
@@ -114,7 +136,7 @@ jobs:
114136
115137 if [ -n "$TEST_FILTER" ]; then
116138 echo "Running filtered tests: $TEST_FILTER"
117- timeout 300 ./bin/vx_test_conformance "$TEST_FILTER" 2>&1 | tee ${{ github.workspace }}/test-results/vision_test_output.txt
139+ timeout 300 ./bin/vx_test_conformance "$TEST_FILTER" 2>&1 | tee ${{ github.workspace }}/test-results/vision_test_output.txt || true
118140 else
119141 echo "Running all Vision tests..."
120142 timeout 300 ./bin/vx_test_conformance 2>&1 | tee ${{ github.workspace }}/test-results/vision_test_output.txt || true
@@ -125,63 +147,58 @@ jobs:
125147 - name : Analyze test results
126148 id : analyze_results
127149 run : |
150+ source $HOME/.cargo/env
128151 echo "========================================"
129152 echo "Analyzing Test Results"
130153 echo "========================================"
131154
132155 OUTPUT_FILE="${{ github.workspace }}/test-results/vision_test_output.txt"
133156
134- if [ -f "$OUTPUT_FILE" ]; then
135- echo "Test output found. Processing results..."
136-
137- # Count passing tests
138- PASS_COUNT=$(grep -c "\[ DONE \]" "$OUTPUT_FILE" 2>/dev/null || echo "0")
139- echo "Tests passed: $PASS_COUNT"
140-
141- # Count failing tests
142- FAIL_COUNT=$(grep -c "\[ !FAILED! \]" "$OUTPUT_FILE" 2>/dev/null || echo "0")
143- echo "Tests failed: $FAIL_COUNT"
144-
145- # Check for crashes
146- if grep -q "double free\|segmentation fault\|core dumped" "$OUTPUT_FILE"; then
147- echo "⚠️ WARNING: Tests crashed!"
148- echo "CRASH_DETECTED=true" >> $GITHUB_ENV
149- fi
150-
151- # Extract test summary
152- echo "========================================" | tee -a ${{ github.workspace }}/test-results/summary.txt
153- echo "Vision Conformance Test Summary" | tee -a ${{ github.workspace }}/test-results/summary.txt
154- echo "========================================" | tee -a ${{ github.workspace }}/test-results/summary.txt
155- echo "Passed: $PASS_COUNT" | tee -a ${{ github.workspace }}/test-results/summary.txt
156- echo "Failed: $FAIL_COUNT" | tee -a ${{ github.workspace }}/test-results/summary.txt
157- echo "Total: $((PASS_COUNT + FAIL_COUNT))" | tee -a ${{ github.workspace }}/test-results/summary.txt
158-
159- if [ "$FAIL_COUNT" -eq 0 ] && [ "$PASS_COUNT" -gt 0 ]; then
160- echo "Status: ✅ ALL TESTS PASSED" | tee -a ${{ github.workspace }}/test-results/summary.txt
161- elif [ "$PASS_COUNT" -gt 0 ]; then
162- echo "Status: ⚠️ PARTIAL SUCCESS ($PASS_COUNT/$((PASS_COUNT + FAIL_COUNT)))" | tee -a ${{ github.workspace }}/test-results/summary.txt
163- else
164- echo "Status: ❌ NO TESTS PASSED" | tee -a ${{ github.workspace }}/test-results/summary.txt
165- fi
166-
167- # Set outputs for GitHub Actions summary
168- echo "pass_count=$PASS_COUNT" >> $GITHUB_OUTPUT
169- echo "fail_count=$FAIL_COUNT" >> $GITHUB_OUTPUT
170-
157+ # Create output file if it doesn't exist
158+ mkdir -p ${{ github.workspace }}/test-results
159+ touch "$OUTPUT_FILE"
160+
161+ # Count passing tests
162+ PASS_COUNT=$(grep -c "\[ DONE \]" "$OUTPUT_FILE" 2>/dev/null || echo "0")
163+ echo "Tests passed: $PASS_COUNT"
164+
165+ # Count failing tests
166+ FAIL_COUNT=$(grep -c "\[ !FAILED! \]" "$OUTPUT_FILE" 2>/dev/null || echo "0")
167+ echo "Tests failed: $FAIL_COUNT"
168+
169+ # Check for crashes
170+ if grep -q "double free\|segmentation fault\|core dumped" "$OUTPUT_FILE" 2>/dev/null; then
171+ echo "⚠️ WARNING: Tests crashed!"
172+ echo "CRASH_DETECTED=true" >> $GITHUB_ENV
173+ fi
174+
175+ # Extract test summary
176+ echo "========================================" | tee ${{ github.workspace }}/test-results/summary.txt
177+ echo "Vision Conformance Test Summary" | tee -a ${{ github.workspace }}/test-results/summary.txt
178+ echo "========================================" | tee -a ${{ github.workspace }}/test-results/summary.txt
179+ echo "Passed: $PASS_COUNT" | tee -a ${{ github.workspace }}/test-results/summary.txt
180+ echo "Failed: $FAIL_COUNT" | tee -a ${{ github.workspace }}/test-results/summary.txt
181+ echo "Total: $((PASS_COUNT + FAIL_COUNT))" | tee -a ${{ github.workspace }}/test-results/summary.txt
182+
183+ if [ "$FAIL_COUNT" -eq 0 ] && [ "$PASS_COUNT" -gt 0 ]; then
184+ echo "Status: ✅ ALL TESTS PASSED" | tee -a ${{ github.workspace }}/test-results/summary.txt
185+ elif [ "$PASS_COUNT" -gt 0 ]; then
186+ echo "Status: ⚠️ PARTIAL SUCCESS ($PASS_COUNT/$((PASS_COUNT + FAIL_COUNT)))" | tee -a ${{ github.workspace }}/test-results/summary.txt
171187 else
172- echo "No test output file found!"
173- echo "pass_count=0" >> $GITHUB_OUTPUT
174- echo "fail_count=0" >> $GITHUB_OUTPUT
188+ echo "Status: ❌ NO TESTS PASSED" | tee -a ${{ github.workspace }}/test-results/summary.txt
175189 fi
190+
191+ # Set outputs for GitHub Actions summary
192+ echo "pass_count=$PASS_COUNT" >> $GITHUB_OUTPUT
193+ echo "fail_count=$FAIL_COUNT" >> $GITHUB_OUTPUT
176194
177195 - name : Upload test results
178- uses : actions/upload-artifact@v4
196+ uses : actions/upload-artifact@v3
179197 if : always()
180198 with :
181199 name : conformance-test-results
182200 path : |
183- ${{ github.workspace }}/test-results/
184- ${{ github.workspace }}/OpenVX-cts/build/bin/*.log 2>/dev/null || true
201+ test-results/
185202 retention-days : 30
186203
187204 - name : Create GitHub Actions Summary
@@ -190,12 +207,13 @@ jobs:
190207 echo "## 🧪 OpenVX Vision Conformance Test Results" >> $GITHUB_STEP_SUMMARY
191208 echo "" >> $GITHUB_STEP_SUMMARY
192209
193- if [ -f "${{ github.workspace }}/ test-results/summary.txt" ]; then
194- cat "${{ github.workspace }}/ test-results/summary.txt" >> $GITHUB_STEP_SUMMARY
210+ if [ -f "test-results/summary.txt" ]; then
211+ cat test-results/summary.txt >> $GITHUB_STEP_SUMMARY
195212 fi
196213
197214 echo "" >> $GITHUB_STEP_SUMMARY
198215 echo "### Build Information" >> $GITHUB_STEP_SUMMARY
216+ source $HOME/.cargo/env
199217 echo "- **Rust Version:** $(rustc --version)" >> $GITHUB_STEP_SUMMARY
200218 echo "- **Build Type:** Release" >> $GITHUB_STEP_SUMMARY
201219 echo "- **CTS Build:** OpenVX Conformance Test Suite" >> $GITHUB_STEP_SUMMARY
@@ -206,39 +224,4 @@ jobs:
206224 fi
207225
208226 echo "" >> $GITHUB_STEP_SUMMARY
209- echo "📥 **Download full logs:** See Artifacts section above" >> $GITHUB_STEP_SUMMARY
210-
211- - name : Comment on PR
212- if : github.event_name == 'pull_request' && always()
213- uses : actions/github-script@v7
214- with :
215- script : |
216- const fs = require('fs');
217- const summaryFile = '${{ github.workspace }}/test-results/summary.txt';
218-
219- let summary = '## OpenVX Vision Conformance Results\n\n';
220-
221- if (fs.existsSync(summaryFile)) {
222- const content = fs.readFileSync(summaryFile, 'utf8');
223- summary += content;
224- } else {
225- summary += 'No test results available.';
226- }
227-
228- github.rest.issues.createComment({
229- issue_number: context.issue.number,
230- owner: context.repo.owner,
231- repo: context.repo.repo,
232- body: summary
233- });
234-
235- - name : Report status
236- if : always()
237- run : |
238- echo "========================================"
239- echo "Workflow Complete"
240- echo "========================================"
241- echo "Test results available in artifacts:"
242- echo "- conformance-test-results"
243- echo ""
244- echo "View full summary in GitHub Actions tab"
227+ echo "📥 **Download full logs:** See Artifacts section above" >> $GITHUB_STEP_SUMMARY
0 commit comments