name: CairoSVG's tests
on: [push, pull_request]

jobs:
  tests:
    name: ${{ matrix.os }} - ${{ matrix.python-version }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]
        python-version: ['3.7', '3.11']
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true
      - uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install CairoSVG
        run: pip install --upgrade -e.[test]
      - name: Setup fonts
        run: |
          mkdir ~/.fonts
          cp ./test_non_regression/resources/*.*tf ~/.fonts
          fc-cache -f -v
      - name: Install tests’ requirements
        run: python -m pip install .[test] pytest-xdist
      - name: Launch tests
        run: python -m pytest -n auto
      - name: Check coding style
        run: python -m flake8
      - name: Check imports order
        run: python -m isort . --check --diff
