This guide explains how to set up and use the continuous integration and deployment pipelines for the Virtual HIL Framework.
- GitHub repository
- GitHub Actions enabled
uvpackage manager installed locally
Located in .github/workflows/:
sil-ci.yml- Software-in-the-Loop CInightly-regression.yml- Nightly regression testsmanual-hil-test.yml- Manual HIL test trigger
Triggers:
- Push to
mainordevelopbranches - Pull requests to
mainordevelopbranches
Steps:
- Checkout code
- Install
uv - Set up Python 3.11
- Install dependencies (
uv sync --dev) - Run unit tests (
pytest) - Run Robot Framework tests
- Upload test reports
Usage: Automatic on push/PR
Triggers:
- Scheduled: Daily at 2 AM UTC
- Manual: Via workflow dispatch
Steps:
- Checkout code
- Install dependencies
- Run full test suite (all directories)
- Generate coverage report
- Upload to Codecov
Usage: Automatic nightly or manual trigger via GitHub UI
Triggers:
- Manual via workflow dispatch
Parameters:
test_suite: Choose which suite to runfunctionaldiagnosticintegrationfault_injectionall
Steps:
- Checkout code
- Install dependencies
- Start ECU simulators
- Run selected test suite
- Upload test results
Usage: Manual trigger via GitHub Actions UI
# Install dependencies
uv sync --dev
# Run unit tests
uv run pytest tests/ -v
# Run Robot Framework tests
uv run robot --pythonpath ./libraries:./ecu_simulation --outputdir reports tests/# Functional tests only
uv run robot --pythonpath ./libraries:./ecu_simulation --outputdir reports tests/functional/
# With specific tags
uv run robot --pythonpath ./libraries:./ecu_simulation --outputdir reports --include smoke tests/uv run pytest --cov=libraries --cov-report=html --cov-report=xml tests/Available in GitHub Actions:
env:
PYTHON_VERSION: "3.11"
UV_VERSION: "latest"All workflows upload test reports as artifacts:
- SIL CI:
test-reports- Contains output.xml, log.html, report.html - Nightly Regression:
coverage-reports- Contains coverage XML - Manual HIL:
hil-test-results- Contains full test output
- Go to Actions tab in GitHub
- Select the workflow run
- Scroll to "Artifacts" section
- Download desired artifact
Add to README.md:
[](https://github.com/username/Virtual-HIL-Framework/actions/workflows/sil-ci.yml)
[](https://github.com/username/Virtual-HIL-Framework/actions/workflows/nightly-regression.yml)Issue: Tests timeout in CI but pass locally
Solution:
- Increase timeout in workflow
- Check for environment-specific timing issues
- Use
--timeoutoption in Robot Framework
Issue: Dependency installation fails
Solution:
- Verify
uv.lockis committed - Check Python version compatibility
- Run
uv lock --upgradelocally and commit
Issue: Cannot find modules
Solution:
- Verify PYTHONPATH includes correct directories
- Check
--pythonpathargument in Robot command - Ensure all files are committed
- Download workflow logs
- Check artifact reports (output.xml, log.html)
- Reproduce locally with same Python version
- Compare environment differences
Add to .github/workflows/sil-ci.yml:
- name: Run Ruff Linter
run: |
uv run ruff check .
uv run ruff format --check .- name: Run MyPy
run: |
uv run mypy ecu_simulation/ libraries/Recommended settings for main branch:
- Require pull request reviews - At least 1 approval
- Require status checks - All CI must pass
- Require branches to be up to date - Before merging
For running with actual CAN hardware:
- Linux machine with physical CAN interface
- Python 3.11 installed
- CAN driver (SocketCAN, etc.)
- Create self-hosted runner in GitHub repository settings
- Install
uvon runner - Configure CAN interface
- Add label to runner (e.g.,
can-hardware)
jobs:
hardware-test:
runs-on: [self-hosted, can-hardware]
steps:
- uses: actions/checkout@v4
- name: Run Hardware Tests
run: |
uv run robot --pythonpath . --outputdir reports tests/hardware/Split tests across multiple jobs:
jobs:
test-functional:
runs-on: ubuntu-latest
steps:
- run: uv run robot tests/functional/
test-diagnostic:
runs-on: ubuntu-latest
steps:
- run: uv run robot tests/diagnostic/GitHub Actions automatically caches uv packages based on uv.lock.
Add to workflow YAML:
- name: Notify on Failure
if: failure()
run: |
# Send Slack notification
curl -X POST ${{ secrets.SLACK_WEBHOOK }} \
-d '{"text":"Tests failed for Virtual HIL Framework"}'- Keep CI fast - Only run necessary tests on PR
- Use caching - Leverage uv's caching
- Matrix testing - Test multiple Python versions if needed
- Artifact retention - Configure appropriate retention period
- Secret management - Use GitHub Secrets for sensitive data
- Documentation - Keep workflow files well-commented