Add yml validation schema generation and schema checker #111
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
linter: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.8" | |
- name: Upgrade pip | |
run: python -m pip install --upgrade pip | |
- name: Install dependencies | |
run: pip install -r requirements_develop.txt | |
- name: Check black format | |
run: black --check --diff --exclude "(open-simulation-interface|proto2cpp|.venv)" . | |
- name: Check dead code with vulture | |
run: vulture *.py tests/ osivalidator/ --min-confidence 100 | |
build-validator: | |
strategy: | |
fail-fast: false | |
matrix: | |
runs-on: [ubuntu-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
name: "🐍 ${{ matrix.python-version }} • ${{ matrix.runs-on }}" | |
runs-on: ${{ matrix.runs-on }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
lfs: true | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set up Virtual Environment | |
run: | | |
python -m venv .venv | |
source .venv/bin/activate | |
python -m pip install --upgrade pip | |
pip install -r requirements_develop.txt | |
- name: Generate parsed rules | |
run: | | |
source .venv/bin/activate | |
pip install -r requirements.txt | |
python rules2yml.py -d rules | |
- name: Check rule correctness with unittests | |
run: | | |
source .venv/bin/activate | |
python -m unittest discover tests | |
- name: Run osi-validator | |
run: | | |
source .venv/bin/activate | |
pip install . | |
osivalidator --data data/20240221T141700Z_sv_300_2112_10_one_moving_object.osi -r rules | |
osivalidator --data data/20240221T141700Z_sv_300_2112_10_one_moving_object.osi -r rules --parallel |