Update favorites (#1193) #1369
This file contains 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
# 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: | |
push: | |
branches: | |
- master | |
pull_request_target: | |
types: [ opened, edited, synchronize ] | |
branches: | |
- master | |
jobs: | |
tests: | |
name: Add-on testing | |
runs-on: ${{ matrix.os }} | |
env: | |
PYTHONIOENCODING: utf-8 | |
PYTHONPATH: ${{ github.workspace }}/resources/lib:${{ github.workspace }}/tests | |
PYPI-HOSTS: "pypi.python.org pypi.org files.pythonhosted.org" | |
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: 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: MatteoH2O1999/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
env: | |
PIP_TRUSTED_HOST: ${{ contains(fromJSON('["3.5"]'), matrix.python-version) && env.PYPI-HOSTS || '' }} | |
- 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 | |
uses: codecov/codecov-action@v4 | |
continue-on-error: true | |
env: | |
OS: '${{ matrix.os }}' | |
PYTHON: '${{ matrix.python-version }}' | |
with: | |
token: '${{ secrets.CODECOV_TOKEN }}' | |
flags: unittests | |
env_vars: 'OS,PYTHON' | |
- name: Analyze with SonarCloud | |
if: contains(matrix.os, 'ubuntu') | |
uses: SonarSource/sonarcloud-github-action@v3 | |
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 |