Skip to content

Initial template library implementation #9

Initial template library implementation

Initial template library implementation #9

# workflow name
name: Tests
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the wanted branches
on:
pull_request:
push:
branches: [master, main]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
linux_tests:
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
matrix:
# Remove unsupported versions and add more versions. Use LTR version in the cov_tests job
docker_tags: [release-3_10, release-3_16, latest]
fail-fast: false
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: true
- name: Pull qgis
run: docker pull qgis/qgis:${{ matrix.docker_tags }}
# Runs all tests
- name: Run tests
run: >
docker run --rm --net=host --volume `pwd`:/app -w=/app -e QGIS_PLUGIN_IN_CI=1 qgis/qgis:${{ matrix.docker_tags }} sh -c
"pip3 install -qr requirements-dev.txt && xvfb-run -s '+extension GLX -screen 0 1024x768x24'
pytest -v --cov=arho_feature_template --cov-report=xml"
# Upload coverage report. Will not work if the repo is private
- name: Upload coverage to Codecov
if: ${{ matrix.docker_tags == 'latest' && !github.event.repository.private }}
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: unittests
fail_ci_if_error: false # set to true when upload is working
verbose: false
windows_tests:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Choco install qgis
uses: crazy-max/ghaction-chocolatey@v1
with:
args: install qgis-ltr -y
- name: Run tests
shell: pwsh
run: |
$env:PATH="C:\Program Files\QGIS 3.16\bin;$env:PATH"
$env:QGIS_PLUGIN_IN_CI=1
python-qgis-ltr.bat -m pip install -qr requirements-dev.txt
python-qgis-ltr.bat -m pytest -v
pre-release:
name: "Pre Release"
runs-on: "ubuntu-latest"
needs: [linux_tests, windows_tests]
steps:
- uses: hmarr/debug-action@v2
- uses: "marvinpinto/action-automatic-releases@latest"
if: ${{ github.event.pull_request }}
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "dev-pr"
prerelease: true
title: "Development Build made for PR #${{ github.event.number }}"
- uses: "marvinpinto/action-automatic-releases@latest"
if: ${{ github.event.after != github.event.before }}
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "dev"
prerelease: true
title: "Development Build made for master branch"
- uses: actions/checkout@v2
with:
submodules: true
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
# Needed if the plugin is using Transifex, to have the lrelease command
# - name: Install Qt lrelease
# run: sudo apt-get update && sudo apt-get install qt5-default qttools5-dev-tools
- name: Install qgis-plugin-ci
run: pip3 install qgis-plugin-ci
# When Transifex is wanted: --transifex-token ${{ secrets.TRANSIFEX_TOKEN }}
- name: Deploy plugin
if: ${{ github.event.pull_request }}
run: qgis-plugin-ci release dev-pr --github-token ${{ secrets.GITHUB_TOKEN }} --disable-submodule-update
# When Transifex is wanted: --transifex-token ${{ secrets.TRANSIFEX_TOKEN }}
- name: Deploy plugin
if: ${{ github.event.after != github.event.before }}
run: qgis-plugin-ci release dev --github-token ${{ secrets.GITHUB_TOKEN }} --disable-submodule-update