diff --git a/.github/workflows/addon-check.yml b/.github/workflows/addon-check.yml index aa15f01..d1d1dd5 100644 --- a/.github/workflows/addon-check.yml +++ b/.github/workflows/addon-check.yml @@ -1,4 +1,4 @@ -name: Kodi +name: Kodi Addon-Check on: # Run action when pushed to master, or for commits in a pull request. push: @@ -19,9 +19,10 @@ jobs: - name: Check out ${{ github.sha }} from repository ${{ github.repository }} uses: actions/checkout@v2 - - name: Run kodi-addon-checker - uses: xbmc/action-kodi-addon-checker@v1.2 - with: - kodi-version: ${{ matrix.kodi-version }} - rewrite-for-matrix: ${{ matrix.kodi-version == 'matrix' }} - addon-id: ${{ github.event.repository.name }} \ No newline at end of file + - name: Install dependencies + run: | + sudo apt-get install libxml2-utils + sudo python -m pip install kodi-addon-checker + + - name: Run Addon Check for Kodi ${{matrix.kodi-version}} + run: make check-addon-${{matrix.kodi-version}} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c3085af..903bb78 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,11 +12,13 @@ jobs: - name: Checkout code uses: actions/checkout@v2 + - name: Install dependencies + run: sudo apt-get install libxml2-utils + - name: Build zip files id: build run: | - sudo apt-get install libxml2-utils - make multizip release=1 + make build-all release=1 echo ::set-output name=leia-filename::$(cd ..;ls plugin.video.viervijfzes*.zip | grep -v '+matrix.' | head -1) echo ::set-output name=matrix-filename::$(cd ..;ls plugin.video.viervijfzes*+matrix.*.zip | head -1) diff --git a/.gitignore b/.gitignore index bad9394..69e0e7c 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ tests/home/userdata/addon_data Pipfile Pipfile.lock +dist/ \ No newline at end of file diff --git a/Makefile b/Makefile index 8f0d3e5..bb415f7 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,21 @@ export KODI_HOME := $(CURDIR)/tests/home export KODI_INTERACTIVE := 0 PYTHON := python -KODI_PYTHON_ABIS := 3.0.0 2.26.0 # 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) -git_branch = $(shell git rev-parse --abbrev-ref HEAD) -git_hash = $(shell git rev-parse --short HEAD) - ifdef release zip_name = $(name)-$(version).zip else + git_branch = $(shell git rev-parse --abbrev-ref HEAD) + git_hash = $(shell git rev-parse --short HEAD) zip_name = $(name)-$(version)-$(git_branch)-$(git_hash).zip endif -zip_dir = $(name)/ - -languages = $(filter-out en_gb, $(patsubst resources/language/resource.language.%, %, $(wildcard resources/language/*))) all: check test build zip: build +multizip: build-all check: check-pylint check-translations @@ -29,17 +25,20 @@ check-pylint: check-translations: @printf ">>> Running translation checks\n" - @$(foreach lang,$(languages), \ + @$(foreach lang,$(filter-out en_gb, $(patsubst resources/language/resource.language.%, %, $(wildcard resources/language/*))), \ msgcmp resources/language/resource.language.$(lang)/strings.po resources/language/resource.language.en_gb/strings.po; \ ) @tests/check_for_unused_translations.py -check-addon: clean build +check-addon: check-addon-matrix + +check-addon-leia: @printf ">>> Running addon checks\n" - $(eval TMPDIR := $(shell mktemp -d)) - @unzip ../${zip_name} -d ${TMPDIR} - cd ${TMPDIR} && kodi-addon-checker --branch=leia - @rm -rf ${TMPDIR} + @make -s build-leia && cd dist/ && kodi-addon-checker --branch=leia + +check-addon-matrix: + @printf ">>> Running addon checks\n" + @make -s build-matrix && cd dist/ && kodi-addon-checker --branch=matrix codefix: @isort -l 160 resources/ @@ -56,12 +55,29 @@ clean: @find . -name '__pycache__' -type d -delete @rm -rf .pytest_cache/ tests/cdm tests/userdata/temp @rm -f *.log .coverage + @rm -rf dist/ -build: clean - @printf ">>> Building package\n" - @rm -f ../$(zip_name) - @git archive --format zip --worktree-attributes -v -o ../$(zip_name) --prefix $(zip_dir) $(or $(shell git stash create), HEAD) - @printf ">>> Successfully wrote package as: ../$(zip_name)\n" +build: build-matrix + +build-all: build-leia build-matrix + +build-leia: clean + $(eval abi=2.26.0) + @rm -rf dist/ && mkdir dist/ + @git archive --format tar --worktree-attributes --prefix $(name)/ $(or $(shell git stash create), HEAD) | (cd dist/ && tar -xf -) + @sed -i -E "s/()?/\2$(abi)\3/" dist/$(name)/addon.xml + @cd dist && zip --quiet -9 -r ../../$(zip_name) $(name) + @printf ">>> Successfully wrote package for Kodi 18 as ../$(zip_name)\n" + +build-matrix: clean + $(eval abi=3.0.0) + $(eval version=$(version)+matrix.1) + @rm -rf dist/ && mkdir dist/ + @git archive --format tar --worktree-attributes --prefix $(name)/ $(or $(shell git stash create), HEAD) | (cd dist/ && tar -xf -) + @sed -i -E "s/()?/\2$(abi)\3/" dist/$(name)/addon.xml + @printf "cd /addon/@version\nset $(version)\nsave\nbye\n" | xmllint --shell dist/$(name)/addon.xml > /dev/null + @cd dist && zip --quiet -9 -r ../../$(zip_name) $(name) + @printf ">>> Successfully wrote package for Kodi 19 as ../$(zip_name)\n" # You first need to run sudo gem install github_changelog_generator for this release: @@ -79,12 +95,3 @@ ifneq ($(release),) else @printf "Usage: make release release=1.0.0\n" endif - -multizip: clean - @-$(foreach abi,$(KODI_PYTHON_ABIS), \ - printf "cd /addon/requires/import[@addon='xbmc.python']/@version\nset $(abi)\nsave\nbye\n" | xmllint --shell addon.xml; \ - matrix=$(findstring $(abi), $(word 1,$(KODI_PYTHON_ABIS))); \ - if [ $$matrix ]; then version=$(version)+matrix.1; else version=$(version); fi; \ - printf "cd /addon/@version\nset $$version\nsave\nbye\n" | xmllint --shell addon.xml; \ - make build; \ - ) diff --git a/addon.xml b/addon.xml index d6883ce..f0e1ea2 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ - +