Add comprehensive documentation and testing framework for ONVIF library
This commit is contained in:
@@ -1,120 +0,0 @@
|
||||
# Example GitHub Actions workflow for camera integration tests
|
||||
# Save as .github/workflows/camera-tests.yml
|
||||
|
||||
name: Camera Integration Tests
|
||||
|
||||
on:
|
||||
# Run on manual trigger
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
camera_endpoint:
|
||||
description: 'Camera ONVIF endpoint'
|
||||
required: true
|
||||
default: 'http://192.168.1.201/onvif/device_service'
|
||||
camera_username:
|
||||
description: 'Camera username'
|
||||
required: true
|
||||
default: 'service'
|
||||
|
||||
# Or run on schedule (daily at 2 AM)
|
||||
schedule:
|
||||
- cron: '0 2 * * *'
|
||||
|
||||
jobs:
|
||||
test-bosch-flexidome:
|
||||
name: Test Bosch FLEXIDOME
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Only run if secrets are configured
|
||||
if: ${{ secrets.ONVIF_TEST_PASSWORD != '' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.21'
|
||||
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
|
||||
- name: Download dependencies
|
||||
run: go mod download
|
||||
|
||||
- name: Run Bosch FLEXIDOME tests
|
||||
env:
|
||||
ONVIF_TEST_ENDPOINT: ${{ github.event.inputs.camera_endpoint || secrets.ONVIF_TEST_ENDPOINT }}
|
||||
ONVIF_TEST_USERNAME: ${{ github.event.inputs.camera_username || secrets.ONVIF_TEST_USERNAME }}
|
||||
ONVIF_TEST_PASSWORD: ${{ secrets.ONVIF_TEST_PASSWORD }}
|
||||
run: |
|
||||
echo "Testing camera at: $ONVIF_TEST_ENDPOINT"
|
||||
go test -v -run TestBoschFLEXIDOMEIndoor5100iIR -timeout 5m
|
||||
|
||||
- name: Run benchmarks
|
||||
if: success()
|
||||
env:
|
||||
ONVIF_TEST_ENDPOINT: ${{ github.event.inputs.camera_endpoint || secrets.ONVIF_TEST_ENDPOINT }}
|
||||
ONVIF_TEST_USERNAME: ${{ github.event.inputs.camera_username || secrets.ONVIF_TEST_USERNAME }}
|
||||
ONVIF_TEST_PASSWORD: ${{ secrets.ONVIF_TEST_PASSWORD }}
|
||||
run: |
|
||||
go test -bench=BenchmarkBoschFLEXIDOMEIndoor5100iIR -benchmem -run=^$ | tee benchmark.txt
|
||||
|
||||
- name: Upload benchmark results
|
||||
if: success()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: benchmark-results
|
||||
path: benchmark.txt
|
||||
|
||||
- name: Generate test coverage
|
||||
if: success()
|
||||
env:
|
||||
ONVIF_TEST_ENDPOINT: ${{ github.event.inputs.camera_endpoint || secrets.ONVIF_TEST_ENDPOINT }}
|
||||
ONVIF_TEST_USERNAME: ${{ github.event.inputs.camera_username || secrets.ONVIF_TEST_USERNAME }}
|
||||
ONVIF_TEST_PASSWORD: ${{ secrets.ONVIF_TEST_PASSWORD }}
|
||||
run: |
|
||||
go test -coverprofile=coverage.out -run TestBoschFLEXIDOMEIndoor5100iIR
|
||||
go tool cover -html=coverage.out -o coverage.html
|
||||
|
||||
- name: Upload coverage report
|
||||
if: success()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: coverage-report
|
||||
path: coverage.html
|
||||
|
||||
- name: Comment test results
|
||||
if: always() && github.event_name == 'workflow_dispatch'
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const outcome = '${{ job.status }}' === 'success' ? '✅ PASSED' : '❌ FAILED';
|
||||
console.log(`Camera integration tests: ${outcome}`);
|
||||
|
||||
# Configuration Instructions:
|
||||
#
|
||||
# 1. Add secrets to your GitHub repository:
|
||||
# - Go to Settings > Secrets and variables > Actions
|
||||
# - Add the following secrets:
|
||||
# * ONVIF_TEST_ENDPOINT (camera URL)
|
||||
# * ONVIF_TEST_USERNAME (camera username)
|
||||
# * ONVIF_TEST_PASSWORD (camera password)
|
||||
#
|
||||
# 2. Ensure your GitHub Actions runner can reach the camera:
|
||||
# - Use self-hosted runner on same network as camera
|
||||
# - Or use VPN/tunnel to access camera from GitHub-hosted runner
|
||||
#
|
||||
# 3. Run manually:
|
||||
# - Go to Actions tab
|
||||
# - Select "Camera Integration Tests"
|
||||
# - Click "Run workflow"
|
||||
# - Optionally override endpoint/username
|
||||
@@ -29,6 +29,7 @@ go.work
|
||||
# Binaries
|
||||
bin/
|
||||
dist/
|
||||
releases/
|
||||
onvif-diagnostics
|
||||
onvif-server
|
||||
onvif-server-example
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# Additional Documentation
|
||||
|
||||
This directory contains supplementary documentation for the onvif-go project.
|
||||
|
||||
## Contents
|
||||
|
||||
- **ARCHITECTURE.md** - System architecture and design decisions
|
||||
- **CAMERA_TESTS.md** - Camera testing framework documentation
|
||||
- **IMPLEMENTATION_SUMMARY.md** - Implementation details and notes
|
||||
- **PROJECT_SUMMARY.md** - Project overview and planning
|
||||
- **TEST_QUICKSTART.md** - Testing quickstart guide
|
||||
- **XML_DEBUGGING_SOLUTION.md** - XML debugging tips and solutions
|
||||
|
||||
## Main Documentation
|
||||
|
||||
For primary documentation, see the root directory:
|
||||
|
||||
- [README.md](../README.md) - Main project documentation
|
||||
- [QUICKSTART.md](../QUICKSTART.md) - Getting started guide
|
||||
- [BUILDING.md](../BUILDING.md) - Build and release instructions
|
||||
- [CONTRIBUTING.md](../CONTRIBUTING.md) - Contribution guidelines
|
||||
- [CHANGELOG.md](../CHANGELOG.md) - Version history and changes
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,46 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Test script for running ONVIF camera integration tests
|
||||
# Usage: ./run-camera-tests.sh [test-name]
|
||||
|
||||
set -e
|
||||
|
||||
# Color output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo -e "${GREEN}=== ONVIF Camera Integration Tests ===${NC}"
|
||||
echo
|
||||
|
||||
# Check if environment variables are set
|
||||
if [ -z "$ONVIF_TEST_ENDPOINT" ] || [ -z "$ONVIF_TEST_USERNAME" ] || [ -z "$ONVIF_TEST_PASSWORD" ]; then
|
||||
echo -e "${YELLOW}Warning: Camera credentials not set${NC}"
|
||||
echo "Set the following environment variables:"
|
||||
echo " export ONVIF_TEST_ENDPOINT=\"http://192.168.1.201/onvif/device_service\""
|
||||
echo " export ONVIF_TEST_USERNAME=\"service\""
|
||||
echo " export ONVIF_TEST_PASSWORD=\"Service.1234\""
|
||||
echo
|
||||
echo -e "${YELLOW}Tests will be skipped.${NC}"
|
||||
echo
|
||||
fi
|
||||
|
||||
# Determine which tests to run
|
||||
TEST_PATTERN="${1:-TestBoschFLEXIDOMEIndoor5100iIR}"
|
||||
|
||||
echo -e "${GREEN}Running tests matching: ${TEST_PATTERN}${NC}"
|
||||
echo
|
||||
|
||||
# Run tests with verbose output
|
||||
go test -v -run "$TEST_PATTERN" -timeout 60s
|
||||
|
||||
# Check exit code
|
||||
if [ $? -eq 0 ]; then
|
||||
echo
|
||||
echo -e "${GREEN}✓ All tests passed!${NC}"
|
||||
else
|
||||
echo
|
||||
echo -e "${RED}✗ Some tests failed${NC}"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user