-
Notifications
You must be signed in to change notification settings - Fork 20
101 lines (100 loc) · 3.98 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# 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