Fix tests #371
This file contains hidden or 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: Run tests | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| tags-ignore: | |
| - '[0-9]+.[0-9]+.[0-9]+' | |
| pull_request: | |
| workflow_call: | |
| jobs: | |
| test: | |
| name: Test, lint, format check | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: | |
| - "3.9" | |
| - "3.10" | |
| - "3.11" | |
| - "3.12" | |
| - "3.13" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: false | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Install library | |
| run: uv sync --all-extras --dev | |
| - name: Run Ruff | |
| run: uv run ruff check . | |
| - name: Type check | |
| run: uv run mypy src | |
| - name: Format | |
| run: > | |
| uv run ruff format --diff | |
| src | |
| tests | |
| - name: Unit tests | |
| run: uv run pytest tests/unit | |
| integration: | |
| name: Integration tests | |
| runs-on: ubuntu-latest | |
| needs: test | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: | |
| - "3.9" | |
| - "3.10" | |
| - "3.11" | |
| - "3.12" | |
| ros_version: | |
| - "7.18.2" | |
| - "6.33.3" | |
| marks: | |
| - "not asyncio" | |
| - "asyncio" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: false | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Create docker image | |
| run: docker create --name images lukaszkostka/librouteros_images:latest /dev/null | |
| - name: Move vm images | |
| run: docker cp images:/opt/routeros_${{ matrix.ros_version }}.qcow2 $GITHUB_WORKSPACE/images/ | |
| - name: Remove docker image | |
| run: docker rm images | |
| - name: Update apt | |
| run: sudo apt-get update | |
| - name: Install packages | |
| run: > | |
| sudo apt-get install -y --no-install-recommends --no-install-suggests | |
| qemu-system-i386 | |
| qemu-utils | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Install library | |
| run: uv sync --all-extras --dev | |
| - name: Integration tests | |
| timeout-minutes: 10 | |
| run: uv run pytest tests/integration -k ${{ matrix.ros_version }} -m "${{ matrix.marks }}" |