168 lines
4.0 KiB
YAML
168 lines
4.0 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, develop ]
|
|
pull_request:
|
|
branches: [ main, develop ]
|
|
|
|
env:
|
|
PYTHON_VERSION: '3.9'
|
|
CXX_STANDARD: '17'
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
|
|
- name: Install Python dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install flake8 black isort mypy pylint
|
|
pip install -r requirements.txt
|
|
|
|
- name: Lint Python code
|
|
run: |
|
|
flake8 src/ --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
black --check src/
|
|
isort --check-only src/
|
|
mypy src/ --ignore-missing-imports
|
|
|
|
test-python:
|
|
name: Test Python
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: [3.8, 3.9, 3.10, 3.11]
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
pip install pytest pytest-cov pytest-mock
|
|
|
|
- name: Run Python tests
|
|
run: |
|
|
pytest src/ --cov=src --cov-report=xml --cov-report=html
|
|
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
file: ./coverage.xml
|
|
flags: python-${{ matrix.python-version }}
|
|
|
|
test-cpp:
|
|
name: Test C++
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y build-essential cmake libopencv-dev libeigen3-dev
|
|
|
|
- name: Build C++ code
|
|
run: |
|
|
mkdir build
|
|
cd build
|
|
cmake ..
|
|
make -j$(nproc)
|
|
|
|
- name: Run C++ tests
|
|
run: |
|
|
cd build
|
|
ctest --output-on-failure
|
|
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
needs: [lint, test-python, test-cpp]
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
sudo apt-get update
|
|
sudo apt-get install -y build-essential cmake libopencv-dev libeigen3-dev
|
|
|
|
- name: Build project
|
|
run: |
|
|
chmod +x tools/build.sh
|
|
./tools/build.sh
|
|
|
|
- name: Upload build artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: build-artifacts
|
|
path: build/
|
|
|
|
security:
|
|
name: Security Scan
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Run Bandit security scan
|
|
run: |
|
|
pip install bandit
|
|
bandit -r src/ -f json -o bandit-report.json
|
|
|
|
- name: Upload security scan results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: security-scan
|
|
path: bandit-report.json
|
|
|
|
documentation:
|
|
name: Build Documentation
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
|
|
- name: Install documentation dependencies
|
|
run: |
|
|
pip install sphinx sphinx-rtd-theme myst-parser
|
|
|
|
- name: Build documentation
|
|
run: |
|
|
cd docs
|
|
make html
|
|
|
|
- name: Upload documentation
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: documentation
|
|
path: docs/_build/html/ |