Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
codecov:
branch: master
coverage:
round: nearest
status:
project:
default:
target: 75%
threshold: 6%
patch: false
comment: false
ignore:
- test/
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.github/ export-ignore
tests/ export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.pylintrc export-ignore
Makefile export-ignore
changelog.txt export-ignore
requirements.txt export-ignore
setup.py export-ignore
tox.ini export-ignore
37 changes: 37 additions & 0 deletions .github/workflows/addon-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Kodi
on:
- pull_request
- push
jobs:
tests:
name: Addon checker
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
kodi-branch: [gotham, helix, isengard, jarvis, krypton, leia, matrix]
steps:
- uses: actions/checkout@v2
with:
path: ${{ github.repository }}
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
sudo apt-get install libxml2-utils xmlstarlet
python -m pip install --upgrade pip
pip install kodi-addon-checker
- name: Remove unwanted files
run: awk '/export-ignore/ { print $1 }' .gitattributes | xargs rm -rf --
working-directory: ${{ github.repository }}
- name: Rewrite addon.xml for Matrix
run: |
xmlstarlet ed -L -u '/addon/requires/import[@addon="xbmc.python"]/@version' -v "3.0.0" addon.xml
version=$(xmllint --xpath 'string(/addon/@version)' addon.xml)
xmlstarlet ed -L -u '/addon/@version' -v "${version}+matrix.99" addon.xml
working-directory: ${{ github.repository }}
if: matrix.kodi-branch == 'matrix'
- name: Run kodi-addon-checker
run: kodi-addon-checker --branch=${{ matrix.kodi-branch }} ${{ github.repository }}/
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CI
on:
- pull_request
- push
jobs:
tests:
name: Add-on testing
runs-on: ubuntu-latest
env:
PYTHONIOENCODING: utf-8
PYTHONPATH: ${{ github.workspace }}/lib:${{ github.workspace }}/tests
strategy:
fail-fast: false
matrix:
# max-parallel: 2
python-version: [ 2.7, 3.5, 3.6, 3.7, 3.8 ]
steps:
- name: Check out ${{ github.sha }} from repository ${{ github.repository }}
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get install gettext
sudo pip install coverage --install-option="--install-scripts=/usr/bin"
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tox
run: python -m tox -q -e flake8,py
- name: Run pylint
run: python -m pylint lib/AddonSignals.py tests/
- name: Run unit tests
run: coverage run -m unittest discover
- name: Upload code coverage to CodeCov
uses: codecov/codecov-action@v1
continue-on-error: true
- name: Analyze with SonarCloud
uses: SonarSource/sonarcloud-github-action@v1.4
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
76 changes: 76 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Release script.module.addon.signals
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build zip files
run: |
sudo apt-get install libxml2-utils
make multizip release=1
- name: Get Leia filename
id: get-leia-filename
run: |
echo ::set-output name=leia-filename::$(cd ..;ls script.module.addon.signals*.zip | grep -v '+matrix.' | head -1)
- name: Get Matrix filename
id: get-matrix-filename
run: |
echo ::set-output name=matrix-filename::$(cd ..;ls script.module.addon.signals*+matrix.*.zip | head -1)
- name: Get body
id: get-body
run: |
description=$(sed '1,/^## Releases$/d;/## v[0-9\.]* ([0-9-]*)/d;/^$/,$d' README.md)
echo $description
description="${description//'%'/'%25'}"
description="${description//$'\n'/'%0A'}"
description="${description//$'\r'/'%0D'}"
echo ::set-output name=body::$description
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ${{ steps.get-body.outputs.body }}
draft: false
prerelease: false
- name: Upload Leia zip
id: upload-leia-zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ${{ steps.get-leia-filename.outputs.leia-filename }}
asset_path: ../${{ steps.get-leia-filename.outputs.leia-filename }}
asset_content_type: application/zip
- name: Upload Matrix zip
id: upload-matrix-zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: ${{ steps.get-matrix-filename.outputs.matrix-filename }}
asset_path: ../${{ steps.get-matrix-filename.outputs.matrix-filename }}
asset_content_type: application/zip
- name: Generate distribution zip and submit to official kodi repository
id: kodi-addon-submitter
uses: xbmc/action-kodi-addon-submitter@v1.2
with:
kodi-repository: repo-scripts
kodi-version: gotham
addon-id: script.module.addon.signals
kodi-matrix: true
env:
GH_USERNAME: ${{secrets.GH_USERNAME}}
GH_TOKEN: ${{secrets.GH_TOKEN}}
EMAIL: ${{secrets.EMAIL}}
12 changes: 10 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Byte-compiled / optimized / DLL files
.coverage
.pytest_cache/
.tox/
__pycache__/
*.py[cod]

*.zip

# Packaging
build/
dist/
*.zip

# Logs
kodi-addon-checker.log
kodi-addon-checker-report.log

# Temporary
experiment/
10 changes: 5 additions & 5 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[MESSAGES CONTROL]
disable=
import-error, # Since xbmc and xbmcaddon are missing
invalid-name, # A lot of names do not follow conventions
line-too-long, # We use flake8 for testing line-length
missing-docstring, # No docstrings are used
old-style-class,
duplicate-code, # Integration tests tend to test similar things
import-outside-toplevel, # Done on purpose to reduce overhead at startup
invalid-name, # Module name or methods do not follow snake_case convention
line-too-long, # Flake8 is used for testing line-length
max-line-length=160
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

47 changes: 22 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
export PYTHONPATH := $(CURDIR)/lib:$(CURDIR)/test
addon_xml := addon.xml
export PYTHONPATH := $(CURDIR)/lib:$(CURDIR)/tests
PYTHON := python

# Collect information to build as sensible package name
name = $(shell xmllint --xpath 'string(/addon/@id)' $(addon_xml))
version = $(shell xmllint --xpath 'string(/addon/@version)' $(addon_xml))
name = $(shell xmllint --xpath 'string(/addon/@id)' addon.xml)
version = $(shell xmllint --xpath 'string(/addon/@version)' addon.xml)
git_branch = $(shell git rev-parse --abbrev-ref HEAD)
git_hash = $(shell git rev-parse --short HEAD)

zip_name = $(name)-$(version)-$(subst /,_,$(git_branch))-$(git_hash).zip
include_files = addon.xml LICENSE.txt README.md icon.png lib/
include_files = addon.xml LICENSE.txt README.md icon.png lib/ resources/
include_paths = $(patsubst %,$(name)/%,$(include_files))
exclude_files = \*.new \*.orig \*.pyc \*.pyo
zip_dir = $(name)/
Expand All @@ -17,41 +16,39 @@ blue = \e[1;34m
white = \e[1;37m
reset = \e[0;39m

.PHONY: test
all: check test build
zip: build
test: check test-unit test-service test-run

all: test zip
check: check-tox check-pylint

package: zip

test: sanity unit

sanity: tox pylint

tox:
check-tox:
@echo -e "$(white)=$(blue) Starting sanity tox test$(reset)"
tox -q
$(PYTHON) -m tox -q

pylint:
check-pylint:
@echo -e "$(white)=$(blue) Starting sanity pylint test$(reset)"
pylint lib/AddonSignals.py test
$(PYTHON) -m pylint lib/AddonSignals.py tests/

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

unit: clean
unit: test-unit

test-unit: clean
@echo -e "$(white)=$(blue) Starting unit tests$(reset)"
python -m unittest discover
$(PYTHON) -m unittest discover -v

zip: clean
build: clean
@echo -e "$(white)=$(blue) Building new package$(reset)"
@rm -f ../$(zip_name)
cd ..; zip -r $(zip_name) $(include_paths) -x $(exclude_files)
@echo -e "$(white)=$(blue) Successfully wrote package as: $(white)../$(zip_name)$(reset)"

clean:
@echo -e "$(white)=$(blue) Cleaning up$(reset)"
find . -name '*.pyc' -type f -delete
find . -name '*.pyo' -type f -delete
find . -name '*.py[cod]' -type f -delete
find . -name '__pycache__' -type d -delete
rm -rf .pytest_cache/ .tox/ *.log
rm -rf .pytest_cache/ .tox/
rm -f *.log
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![GitHub release](https://img.shields.io/github/release/ruuk/script.module.addon.signals.svg)](https://github.com/ruuk/script.module.addon.signals/releases)
[![Build Status](https://travis-ci.org/ruuk/script.module.addon.signals.svg?branch=master)](https://travis-ci.org/ruuk/script.module.addon.signals)
[![License: LGPL-2.1](https://img.shields.io/badge/license-lgpl__2__1-blue)](https://opensource.org/licenses/LGPL-2.1)
[![License: LGPL-2.1 or later](https://img.shields.io/badge/license-LGPLv2.1_or_later-blue)](https://opensource.org/licenses/LGPL-2.1)
[![Contributors](https://img.shields.io/github/contributors/ruuk/script.module.addon.signals.svg)](https://github.com/ruuk/script.module.addon.signals/graphs/contributors)

# script.module.addon.signals
Expand Down
4 changes: 2 additions & 2 deletions addon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<summary lang="en_GB">Inter-addon signalling</summary>
<description lang="en_GB">Provides signal/slot mechanism for inter-addon communication</description>
<platform>all</platform>
<license>LGPL-2.1-only</license>
<license>LGPL-2.1-or-later</license>
<source>https://github.com/ruuk/script.module.addon.signals</source>
<assets>
<icon>icon.png</icon>
<icon>resources/icon.png</icon>
</assets>
</extension>
</addon>
Loading