|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - master |
| 9 | + |
| 10 | +jobs: |
| 11 | + linter: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Set up Python 3.8 |
| 21 | + uses: actions/setup-python@v5 |
| 22 | + with: |
| 23 | + python-version: "3.8" |
| 24 | + |
| 25 | + - name: Upgrade pip |
| 26 | + run: python -m pip install --upgrade pip |
| 27 | + |
| 28 | + - name: Install dependencies |
| 29 | + run: pip install -r requirements_develop.txt |
| 30 | + |
| 31 | + - name: Check black format |
| 32 | + run: black --check --diff --exclude "(open-simulation-interface|proto2cpp|.venv)" . |
| 33 | + |
| 34 | + - name: Check dead code with vulture |
| 35 | + run: vulture *.py tests/ osivalidator/ --min-confidence 100 |
| 36 | + |
| 37 | + build-validator: |
| 38 | + strategy: |
| 39 | + fail-fast: false |
| 40 | + matrix: |
| 41 | + runs-on: [ubuntu-latest] |
| 42 | + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] |
| 43 | + |
| 44 | + name: "🐍 ${{ matrix.python-version }} • ${{ matrix.runs-on }}" |
| 45 | + runs-on: ${{ matrix.runs-on }} |
| 46 | + |
| 47 | + steps: |
| 48 | + - name: Checkout |
| 49 | + uses: actions/checkout@v4 |
| 50 | + with: |
| 51 | + lfs: true |
| 52 | + |
| 53 | + - name: Set up Python ${{ matrix.python-version }} |
| 54 | + uses: actions/setup-python@v5 |
| 55 | + with: |
| 56 | + python-version: ${{ matrix.python-version }} |
| 57 | + |
| 58 | + - name: Cache Dependencies |
| 59 | + id: cache-depends |
| 60 | + uses: actions/cache@v3 |
| 61 | + with: |
| 62 | + path: protobuf-3.20.1 |
| 63 | + key: ${{ runner.os }}-v2-depends |
| 64 | + |
| 65 | + - name: Download ProtoBuf |
| 66 | + if: steps.cache-depends.outputs.cache-hit != 'true' |
| 67 | + run: curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.20.1/protobuf-all-3.20.1.tar.gz && tar xzvf protobuf-all-3.20.1.tar.gz |
| 68 | + |
| 69 | + - name: Build ProtoBuf |
| 70 | + if: steps.cache-depends.outputs.cache-hit != 'true' |
| 71 | + working-directory: protobuf-3.20.1 |
| 72 | + run: ./configure DIST_LANG=cpp --prefix=/usr && make |
| 73 | + |
| 74 | + - name: Install ProtoBuf |
| 75 | + working-directory: protobuf-3.20.1 |
| 76 | + run: sudo make install && sudo ldconfig |
| 77 | + |
| 78 | + - name: Install Open Simulation Interface |
| 79 | + shell: bash |
| 80 | + run: | |
| 81 | + git submodule update --init |
| 82 | + python -m venv .venv |
| 83 | + source .venv/bin/activate |
| 84 | + python -m pip install --upgrade pip |
| 85 | + pip install -r requirements_develop.txt |
| 86 | + cd open-simulation-interface && pip install . && cd .. |
| 87 | +
|
| 88 | + - name: Generate parsed rules |
| 89 | + run: | |
| 90 | + source .venv/bin/activate |
| 91 | + pip install -r requirements.txt |
| 92 | + python rules2yml.py -d rules |
| 93 | +
|
| 94 | + - name: Check rule correctness with unittests |
| 95 | + run: | |
| 96 | + source .venv/bin/activate |
| 97 | + python -m unittest discover tests |
| 98 | + |
| 99 | + - name: Run osi-validator |
| 100 | + run: | |
| 101 | + source .venv/bin/activate |
| 102 | + pip install . |
| 103 | + osivalidator --data data/20210818T150542Z_sv_312_50_one_moving_object.txt -r rules |
| 104 | + osivalidator --data data/20210818T150542Z_sv_312_50_one_moving_object.txt -r rules --parallel |
| 105 | + osivalidator --data data/20210818T150542Z_sv_312_50_one_moving_object.osi -r rules |
| 106 | + osivalidator --data data/20210818T150542Z_sv_312_50_one_moving_object.osi -r rules --parallel |
0 commit comments