|
| 1 | +# workflow name |
| 2 | +name: Tests |
| 3 | + |
| 4 | +# Controls when the action will run. Triggers the workflow on push or pull request |
| 5 | +# events but only for the wanted branches |
| 6 | +on: |
| 7 | + pull_request: |
| 8 | + push: |
| 9 | + branches: [main] |
| 10 | + |
| 11 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 12 | +jobs: |
| 13 | + linux_tests: |
| 14 | + # The type of runner that the job will run on |
| 15 | + runs-on: ubuntu-latest |
| 16 | + container: |
| 17 | + image: qgis/qgis:${{ matrix.qgis-image-tags }} |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + # Remove unsupported versions and add more versions. Use LTR version in the cov_tests job |
| 21 | + qgis-image-tags: [release-3_28, release-3_34, latest] |
| 22 | + fail-fast: false |
| 23 | + |
| 24 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 25 | + steps: |
| 26 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + submodules: true |
| 30 | + |
| 31 | + - name: Install dependencies |
| 32 | + run: | |
| 33 | + apt update && apt install python3-venv -y |
| 34 | + python3 -m venv --system-site-packages .venv |
| 35 | + .venv/bin/python -m pip install -U setuptools pip |
| 36 | + .venv/bin/pip install -r requirements-test.txt |
| 37 | + .venv/bin/pip install . |
| 38 | +
|
| 39 | + - name: Run tests |
| 40 | + env: |
| 41 | + QGIS_PLUGIN_IN_CI: 1 |
| 42 | + QT_QPA_PLATFORM: offscreen |
| 43 | + run: | |
| 44 | + .venv/bin/pytest |
| 45 | +
|
| 46 | + windows_tests: |
| 47 | + runs-on: windows-latest |
| 48 | + |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v2 |
| 51 | + with: |
| 52 | + submodules: true |
| 53 | + |
| 54 | + - name: Choco install qgis |
| 55 | + uses: crazy-max/ghaction-chocolatey@v1 |
| 56 | + with: |
| 57 | + args: install qgis-ltr -y |
| 58 | + |
| 59 | + - name: Run tests |
| 60 | + shell: pwsh |
| 61 | + run: | |
| 62 | + $env:QGIS_PATH = (Get-ChildItem "C:\Program Files\QGIS *\bin" | Select-Object -First 1 -ExpandProperty FullName) |
| 63 | + $env:PATH="$env:QGIS_PATH;$env:PATH" |
| 64 | + $env:QGIS_PLUGIN_IN_CI=1 |
| 65 | + python-qgis-ltr.bat -m pip install -qr requirements-test.txt |
| 66 | + python-qgis-ltr.bat -m pip install . |
| 67 | + python-qgis-ltr.bat -m pytest -v |
0 commit comments