Skip to content

Fix CI workflow: update Rust action, remove submodules option #3

Fix CI workflow: update Rust action, remove submodules option

Fix CI workflow: update Rust action, remove submodules option #3

name: OpenVX Vision Conformance
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
inputs:
test_filter:
description: 'Test filter pattern (optional)'
required: false
default: ''
verbose:
description: 'Verbose output'
required: false
default: 'false'
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
build-and-test:
runs-on: ubuntu-22.04
timeout-minutes: 60
steps:
- name: Checkout rustVX
uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
ninja-build \
libgtest-dev \
libopencv-dev \
python3 \
python3-pip
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
shared-key: "openvx-build"
- name: Cache OpenVX CTS build
id: cache-cts
uses: actions/cache@v4
with:
path: |
OpenVX-cts/build
key: ${{ runner.os }}-cts-${{ hashFiles('OpenVX-cts/CMakeLists.txt') }}
- name: Build rustVX
run: |
echo "Building rustVX..."
cargo build --release
echo "Build complete. Library files:"
ls -la target/release/*.so target/release/*.rlib 2>/dev/null || true
- name: Build OpenVX CTS (if not cached)
if: steps.cache-cts.outputs.cache-hit != 'true'
run: |
echo "Building OpenVX CTS..."
cd OpenVX-cts
mkdir -p build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DOpenVX_SOURCE_DIR=../openvx \
-G Ninja
ninja -j$(nproc)
echo "CTS build complete."
- name: Prepare test environment
run: |
echo "Setting up test environment..."
echo "RUSTVX_LIBRARY_PATH=${{ github.workspace }}/target/release" >> $GITHUB_ENV
echo "CTS_BUILD_DIR=${{ github.workspace }}/OpenVX-cts/build" >> $GITHUB_ENV
- name: Run Vision Conformance Tests
id: run_tests
continue-on-error: true
run: |
echo "========================================"
echo "Running OpenVX Vision Conformance Tests"
echo "========================================"
cd $CTS_BUILD_DIR
# Set library path for the conformance tests
export LD_LIBRARY_PATH=${{ github.workspace }}/target/release:$LD_LIBRARY_PATH
echo "Library path: $LD_LIBRARY_PATH"
echo "Checking for rustVX library..."
ls -la ${{ github.workspace }}/target/release/*.so 2>/dev/null || echo "No .so files found"
# Create output directory for results
mkdir -p ${{ github.workspace }}/test-results
# Run tests with timeout and capture output
TEST_FILTER="${{ github.event.inputs.test_filter }}"
VERBOSE="${{ github.event.inputs.verbose }}"
if [ -n "$TEST_FILTER" ]; then
echo "Running filtered tests: $TEST_FILTER"
timeout 300 ./bin/vx_test_conformance "$TEST_FILTER" 2>&1 | tee ${{ github.workspace }}/test-results/vision_test_output.txt
else
echo "Running all Vision tests..."
timeout 300 ./bin/vx_test_conformance 2>&1 | tee ${{ github.workspace }}/test-results/vision_test_output.txt || true
fi
echo "Test execution completed."
- name: Analyze test results
id: analyze_results
run: |
echo "========================================"
echo "Analyzing Test Results"
echo "========================================"
OUTPUT_FILE="${{ github.workspace }}/test-results/vision_test_output.txt"
if [ -f "$OUTPUT_FILE" ]; then
echo "Test output found. Processing results..."
# Count passing tests
PASS_COUNT=$(grep -c "\[ DONE \]" "$OUTPUT_FILE" 2>/dev/null || echo "0")
echo "Tests passed: $PASS_COUNT"
# Count failing tests
FAIL_COUNT=$(grep -c "\[ !FAILED! \]" "$OUTPUT_FILE" 2>/dev/null || echo "0")
echo "Tests failed: $FAIL_COUNT"
# Check for crashes
if grep -q "double free\|segmentation fault\|core dumped" "$OUTPUT_FILE"; then
echo "⚠️ WARNING: Tests crashed!"
echo "CRASH_DETECTED=true" >> $GITHUB_ENV
fi
# Extract test summary
echo "========================================" | tee -a ${{ github.workspace }}/test-results/summary.txt
echo "Vision Conformance Test Summary" | tee -a ${{ github.workspace }}/test-results/summary.txt
echo "========================================" | tee -a ${{ github.workspace }}/test-results/summary.txt
echo "Passed: $PASS_COUNT" | tee -a ${{ github.workspace }}/test-results/summary.txt
echo "Failed: $FAIL_COUNT" | tee -a ${{ github.workspace }}/test-results/summary.txt
echo "Total: $((PASS_COUNT + FAIL_COUNT))" | tee -a ${{ github.workspace }}/test-results/summary.txt
if [ "$FAIL_COUNT" -eq 0 ] && [ "$PASS_COUNT" -gt 0 ]; then
echo "Status: ✅ ALL TESTS PASSED" | tee -a ${{ github.workspace }}/test-results/summary.txt
elif [ "$PASS_COUNT" -gt 0 ]; then
echo "Status: ⚠️ PARTIAL SUCCESS ($PASS_COUNT/$((PASS_COUNT + FAIL_COUNT)))" | tee -a ${{ github.workspace }}/test-results/summary.txt
else
echo "Status: ❌ NO TESTS PASSED" | tee -a ${{ github.workspace }}/test-results/summary.txt
fi
# Set outputs for GitHub Actions summary
echo "pass_count=$PASS_COUNT" >> $GITHUB_OUTPUT
echo "fail_count=$FAIL_COUNT" >> $GITHUB_OUTPUT
else
echo "No test output file found!"
echo "pass_count=0" >> $GITHUB_OUTPUT
echo "fail_count=0" >> $GITHUB_OUTPUT
fi
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: conformance-test-results
path: |
${{ github.workspace }}/test-results/
${{ github.workspace }}/OpenVX-cts/build/bin/*.log 2>/dev/null || true
retention-days: 30
- name: Create GitHub Actions Summary
if: always()
run: |
echo "## 🧪 OpenVX Vision Conformance Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -f "${{ github.workspace }}/test-results/summary.txt" ]; then
cat "${{ github.workspace }}/test-results/summary.txt" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Build Information" >> $GITHUB_STEP_SUMMARY
echo "- **Rust Version:** $(rustc --version)" >> $GITHUB_STEP_SUMMARY
echo "- **Build Type:** Release" >> $GITHUB_STEP_SUMMARY
echo "- **CTS Build:** OpenVX Conformance Test Suite" >> $GITHUB_STEP_SUMMARY
if [ "${{ env.CRASH_DETECTED }}" == "true" ]; then
echo "" >> $GITHUB_STEP_SUMMARY
echo "⚠️ **Warning:** Tests encountered crashes. See artifacts for details." >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "📥 **Download full logs:** See Artifacts section above" >> $GITHUB_STEP_SUMMARY
- name: Comment on PR
if: github.event_name == 'pull_request' && always()
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const summaryFile = '${{ github.workspace }}/test-results/summary.txt';
let summary = '## OpenVX Vision Conformance Results\n\n';
if (fs.existsSync(summaryFile)) {
const content = fs.readFileSync(summaryFile, 'utf8');
summary += content;
} else {
summary += 'No test results available.';
}
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: summary
});
- name: Report status
if: always()
run: |
echo "========================================"
echo "Workflow Complete"
echo "========================================"
echo "Test results available in artifacts:"
echo "- conformance-test-results"
echo ""
echo "View full summary in GitHub Actions tab"