Skip to content

Commit

Permalink
migrate Azure Pipelines to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
h1dden-da3m0n committed May 14, 2021
1 parent b6cd28e commit 9b3edc8
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 168 deletions.
35 changes: 0 additions & 35 deletions .ci/azure-pipelines.yml

This file was deleted.

46 changes: 0 additions & 46 deletions .ci/build.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .ci/publish.yml

This file was deleted.

58 changes: 0 additions & 58 deletions .ci/validate.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .config/generate_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def indent(elem, level=0):
deps = yaml.safe_load(f)

# Load version and changelog
with open('jellyfin-kodi/release.yaml', 'r') as f:
with open('release.yaml', 'r') as f:
data = yaml.safe_load(f)

# Populate xml template
Expand All @@ -67,4 +67,4 @@ def indent(elem, level=0):
indent(root)

# Write addon.xml
tree.write('jellyfin-kodi/addon.xml', encoding='utf-8', xml_declaration=True)
tree.write('addon.xml', encoding='utf-8', xml_declaration=True)
81 changes: 81 additions & 0 deletions .github/workflows/build-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Build Jellyfin-Kodi

on:
push:
branches:
- master
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
py_version: [ 'py2', 'py3' ]
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pyyaml
- name: Create ${{ matrix.py_version }} addon.xml
run: python .config/generate_xml.py ${{ matrix.py_version }}

- name: Publish Build Atrifact
uses: actions/upload-artifact@v2
with:
retention-days: 14
name: ${{ matrix.py_version }}-build-artifact
path: |
**/*
!.ci/*
!.config/*
!.git/**/*
!.github/*
publish:
runs-on: ubuntu-latest
needs: build
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository == 'jellyfin/jellyfin-kodi' }}
strategy:
matrix:
py_version: [ 'py2', 'py3' ]
steps:
- uses: actions/download-artifact@v2
with:
name: ${{ matrix.py_version }}-build-artifact
path: plugin.video.jellyfin-${{ matrix.py_version }}

- name: Create release Zip
run: zip -rq plugin.video.jellyfin-${{ matrix.py_version }}.zip plugin.video.jellyfin-${{ matrix.py_version }}

- name: Upload to repo server
uses: burnett01/[email protected]
with:
switches: -rltgoDzvO --delete --exclude='*' --include='**/*.apk' --include='*.txt'
path: plugin.video.jellyfin-${{ matrix.py_version }}.zip
remote_path: /srv/repository/incoming/kodi
remote_host: ${{ secrets.DEPLOY_HOST }}
remote_user: ${{ secrets.DEPLOY_USER }}
remote_key: ${{ secrets.DEPLOY_KEY }}

- name: Add to Kodi repo and clean up
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
envs: JELLYFIN_VERSION
script_stop: true
script: |
python3 /usr/local/bin/kodirepo add /srv/repository/incoming/kodi/plugin.video.jellyfin-${{ matrix.py_version }}.zip --datadir /srv/repository/releases/client/kodi/${{ matrix.py_version }};
rm /srv/repository/incoming/kodi/plugin.video.jellyfin-${{ matrix.py_version }}.zip;
41 changes: 41 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CodeQL Analysis

on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: '38 8 * * 6'

jobs:
analyze:
runs-on: ubuntu-latest
if: ${{ github.repository == 'jellyfin/jellyfin-kodi' }}
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
version: ['2.7', '3.9']
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.version }}

- name: Autobuild
uses: github/codeql-action/autobuild@v1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
77 changes: 77 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Test Jellyfin-Kodi

on:
push:
branches:
- master
pull_request:
branches:
- master

env:
PR_TRIGGERED: ${{ github.event_name == 'pull_request' && github.repository == 'jellyfin/jellyfin-kodi' }}

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
py_version: ['2.7', '3.9']
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.py_version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py_version }}

- name: Setup reviewdog
uses: reviewdog/action-setup@v1
if: ${{ env.PR_TRIGGERED == 'true' && matrix.py_version == '3.9' }}
with:
reviewdog_version: nightly

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-dev.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --output-file=flake8.output
cat flake8.output
- name: Test with Coverage
run: |
coverage run
coverage xml
coverage report
- name: Run reviewdog for PR checks-api
if: ${{ env.PR_TRIGGERED == 'true' && matrix.py_version == '3.9' }}
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat flake8.output | reviewdog -reporter=github-pr-check -f=flake8 -name="flake8"
- name: Publish Coverage to PR
uses: 5monkeys/cobertura-action@v8
if: ${{ env.PR_TRIGGERED == 'true' && matrix.py_version == '3.9' }}
with:
path: coverage.xml
repo_token: ${{ secrets.JF_BOT_TOKEN }}
minimum_coverage: 1

- name: Publish Test Atrifact
uses: actions/upload-artifact@v2
with:
retention-days: 14
name: ${{ matrix.py_version }}-test-results
path: |
flake8.output
test.xml
coverage.xml

0 comments on commit 9b3edc8

Please sign in to comment.