Skip to content

Fix ci

Fix ci #1329

Workflow file for this run

# This workflow performs the various sanity tests, integration tests and
# may run parts of the add-on and add-on service to get a better testing
# coverage. It also runs Codecov and SonarCloud actions.
name: CI
on:
- pull_request
- push
jobs:
tests:
name: Add-on testing
runs-on: ${{ matrix.os }}
env:
PYTHONIOENCODING: utf-8
PYTHONPATH: ${{ github.workspace }}/resources/lib:${{ github.workspace }}/tests
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest ]
python-version: ['3.8', '3.9', '3.10', '3.11' ]
include:
# End-of-life Python versions are not available anymore with ubuntu-latest
- os: ubuntu-20.04
python-version: '2.7'
- os: ubuntu-20.04
python-version: '3.5'
- os: ubuntu-20.04
python-version: '3.6'
# Kodi Leia on Windows uses a bundled Python 2.7.
- os: windows-latest
python-version: '2.7'
steps:
- name: Check out ${{ github.sha }} from repository ${{ github.repository }}
uses: actions/checkout@v4
- name: Ignore certificate verification on Python 3.5
shell: bash
run: |
# INSECURE!! But it should be OK for CI tests.
echo 'PIP_TRUSTED_HOST=pypi.python.org pypi.org files.pythonhosted.org' >>$GITHUB_ENV
if: 'matrix.python-version == 3.5'
- name: Setup PYTHONPATH (windows)
if: contains(matrix.os, 'windows')
run: echo "PYTHONPATH=${env:PYTHONPATH};${env:GITHUB_WORKSPACE};${env:GITHUB_WORKSPACE}\resources\lib;${env:GITHUB_WORKSPACE}\tests" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies (linux)
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get install gettext -y
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tox
run: python -m tox -q -e flake8,py
if: always()
- name: Run pylint
run: python -m pylint resources/lib/ tests/
if: always()
- name: Compare translations
run: make check-translations
if: contains(matrix.os, 'ubuntu')
# Python 2.7 and Python 3.5 are no longer supported by proxy.py
- name: Start proxy server, when supported (linux)
run: python -m proxy --hostname 127.0.0.1 --log-level DEBUG &
if: contains(fromJson('["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]'), matrix.python-version) && contains(matrix.os, 'ubuntu')
- name: Start proxy server, when supported (windows)
run: Start-Process python -ArgumentList '-m proxy --hostname 127.0.0.1 --log-level DEBUG'
if: contains(fromJson('["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]'), matrix.python-version) && contains(matrix.os, 'windows')
- name: Run unit tests
run: coverage run -m unittest discover
env:
ADDON_PASSWORD: ${{ secrets.ADDON_PASSWORD }}
ADDON_USERNAME: ${{ secrets.ADDON_USERNAME }}
if: always()
- name: Run addon service
run: coverage run -a resources/lib/service_entry.py
env:
ADDON_PASSWORD: ${{ secrets.ADDON_PASSWORD }}
ADDON_USERNAME: ${{ secrets.ADDON_USERNAME }}
if: always()
- name: Run addon using cli
run: coverage run -a tests/run.py /
if: always()
- name: Upload code coverage to CodeCov
if: contains(matrix.os, 'ubuntu')
uses: codecov/codecov-action@v3
continue-on-error: true
- name: Analyze with SonarCloud
if: contains(matrix.os, 'ubuntu')
uses: SonarSource/sonarcloud-github-action@v1.8
with:
args: >
-Dsonar.organization=add-ons
-Dsonar.projectKey=add-ons_plugin.video.vrt.nu
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
continue-on-error: true