Skip to content

Commit 0b0dbaa

Browse files
committed
Move from Travis CI to GitHub CI
This commit includes: - Add .gitattributes to get a proper ZIP pakage - Remove Travis CI - Add a GitHub CI workflow for unit testing, codecov and SonarCloud - Add a GitHub CI workflow for kodi-addon-checker - Move add-on icon to resources/
1 parent c189256 commit 0b0dbaa

14 files changed

Lines changed: 117 additions & 49 deletions

File tree

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.github/ export-ignore
2+
tests/ export-ignore
3+
.gitattributes export-ignore
4+
.gitignore export-ignore
5+
.pylintrc export-ignore
6+
Makefile export-ignore
7+
changelog.txt export-ignore
8+
requirements.txt export-ignore
9+
setup.py export-ignore
10+
tox.ini export-ignore

.github/workflows/addon-check.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Kodi
2+
on:
3+
- pull_request
4+
- push
5+
jobs:
6+
tests:
7+
name: Addon checker
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
kodi-branch: [krypton, leia, matrix]
13+
steps:
14+
- uses: actions/checkout@v2
15+
with:
16+
path: ${{ github.repository }}
17+
- name: Set up Python 3.8
18+
uses: actions/setup-python@v1
19+
with:
20+
python-version: 3.8
21+
- name: Install dependencies
22+
run: |
23+
sudo apt-get install libxml2-utils xmlstarlet
24+
python -m pip install --upgrade pip
25+
# FIXME: Requires changes from xbmc/addon-check#217
26+
#pip install kodi-addon-checker
27+
pip install git+git://github.com/xbmc/addon-check.git@master
28+
- name: Remove unwanted files
29+
run: awk '/export-ignore/ { print $1 }' .gitattributes | xargs rm -rf --
30+
working-directory: ${{ github.repository }}
31+
- name: Rewrite addon.xml for Matrix
32+
run: |
33+
xmlstarlet ed -L -u '/addon/requires/import[@addon="xbmc.python"]/@version' -v "3.0.0" addon.xml
34+
version=$(xmllint --xpath 'string(/addon/@version)' addon.xml)
35+
xmlstarlet ed -L -u '/addon/@version' -v "${version}+matrix.99" addon.xml
36+
working-directory: ${{ github.repository }}
37+
if: matrix.kodi-branch == 'matrix'
38+
- name: Run kodi-addon-checker
39+
run: kodi-addon-checker --branch=${{ matrix.kodi-branch }} ${{ github.repository }}/

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
on:
3+
- pull_request
4+
- push
5+
jobs:
6+
tests:
7+
name: Add-on testing
8+
runs-on: ubuntu-latest
9+
env:
10+
PYTHONIOENCODING: utf-8
11+
PYTHONPATH: ${{ github.workspace }}/lib:${{ github.workspace }}/tests
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
# max-parallel: 2
16+
python-version: [ 2.7, 3.5, 3.6, 3.7, 3.8 ]
17+
steps:
18+
- name: Check out ${{ github.sha }} from repository ${{ github.repository }}
19+
uses: actions/checkout@v2
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v1
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install dependencies
25+
run: |
26+
sudo apt-get install gettext
27+
sudo pip install coverage --install-option="--install-scripts=/usr/bin"
28+
python -m pip install --upgrade pip
29+
pip install -r requirements.txt
30+
- name: Run tox
31+
run: python -m tox -q -e flake8,py
32+
- name: Run pylint
33+
run: python -m pylint lib/ tests/
34+
- name: Run unit tests
35+
run: coverage run -m unittest discover
36+
- name: Upload code coverage to CodeCov
37+
uses: codecov/codecov-action@v1
38+
continue-on-error: true
39+
# FIXME: Requires changes from SonarSource/sonarcloud-github-action#9
40+
- name: Analyze with SonarCloud
41+
uses: dagwieers/sonarcloud-github-action@more-options
42+
with:
43+
organization: add-ons
44+
projectKey: add-ons_plugin.video.vrt.nu
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
48+
continue-on-error: true

.travis.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

Makefile

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export PYTHONPATH := $(CURDIR)/lib:$(CURDIR)/test
1+
export PYTHONPATH := $(CURDIR)/lib:$(CURDIR)/tests
22
PYTHON := python
33

44
name = $(shell xmllint --xpath 'string(/addon/@id)' addon.xml)
@@ -7,7 +7,7 @@ git_branch = $(shell git rev-parse --abbrev-ref HEAD)
77
git_hash = $(shell git rev-parse --short HEAD)
88

99
zip_name = $(name)-$(version)-$(subst /,_,$(git_branch))-$(git_hash).zip
10-
include_files = addon.xml LICENSE.txt README.md icon.png lib/
10+
include_files = addon.xml LICENSE.txt README.md icon.png lib/ resources/
1111
include_paths = $(patsubst %,$(name)/%,$(include_files))
1212
exclude_files = \*.new \*.orig \*.pyc \*.pyo
1313
zip_dir = $(name)/
@@ -16,33 +16,31 @@ blue = \e[1;34m
1616
white = \e[1;37m
1717
reset = \e[0;39m
1818

19-
.PHONY: test
19+
all: check test build
20+
zip: build
21+
test: check test-unit test-service test-run
2022

21-
all: test zip
23+
check: check-tox check-pylint
2224

23-
package: zip
24-
25-
test: sanity unit
26-
27-
sanity: tox pylint
28-
29-
tox:
25+
check-tox:
3026
@echo -e "$(white)=$(blue) Starting sanity tox test$(reset)"
3127
$(PYTHON) -m tox -q
3228

33-
pylint:
29+
check-pylint:
3430
@echo -e "$(white)=$(blue) Starting sanity pylint test$(reset)"
35-
$(PYTHON) -m pylint lib/AddonSignals.py test/
31+
$(PYTHON) -m pylint lib/AddonSignals.py tests/
3632

37-
addon: clean
33+
check-addon: clean
3834
@echo -e "$(white)=$(blue) Starting sanity addon tests$(reset)"
3935
kodi-addon-checker . --branch=gotham
4036

41-
unit: clean
37+
unit: test-unit
38+
39+
test-unit: clean
4240
@echo -e "$(white)=$(blue) Starting unit tests$(reset)"
43-
$(PYTHON) -m unittest discover
41+
$(PYTHON) -m unittest discover -v
4442

45-
zip: clean
43+
build: clean
4644
@echo -e "$(white)=$(blue) Building new package$(reset)"
4745
@rm -f ../$(zip_name)
4846
cd ..; zip -r $(zip_name) $(include_paths) -x $(exclude_files)
@@ -52,4 +50,5 @@ clean:
5250
@echo -e "$(white)=$(blue) Cleaning up$(reset)"
5351
find . -name '*.py[cod]' -type f -delete
5452
find . -name '__pycache__' -type d -delete
55-
rm -rf .pytest_cache/ .tox/ *.log
53+
rm -rf .pytest_cache/ .tox/
54+
rm -f *.log

addon.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<license>LGPL-2.1-or-later</license>
1515
<source>https://github.com/ruuk/script.module.addon.signals</source>
1616
<assets>
17-
<icon>icon.png</icon>
17+
<icon>resources/icon.png</icon>
1818
</assets>
1919
</extension>
2020
</addon>

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
codecov
2-
kodi-addon-checker
2+
kodi-addon-checker; python_version >= '3.5'
33
pylint
44
setuptools >= 41
5-
tox-travis
5+
tox
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)