2021-05-14 15:18:54 +00:00
|
|
|
name: Test Jellyfin-Kodi
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2021-06-01 19:26:59 +00:00
|
|
|
pull_request_target:
|
2021-05-14 15:18:54 +00:00
|
|
|
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:
|
2021-06-01 19:26:59 +00:00
|
|
|
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.JF_BOT_TOKEN }}
|
2021-05-14 15:18:54 +00:00
|
|
|
run: |
|
|
|
|
cat flake8.output | reviewdog -reporter=github-pr-check -f=flake8 -name="flake8"
|
|
|
|
|
2021-05-23 18:17:34 +00:00
|
|
|
- name: Upload coverage
|
|
|
|
uses: codecov/codecov-action@v1
|
|
|
|
if: ${{ matrix.py_version == '3.9' }}
|
2021-05-14 15:18:54 +00:00
|
|
|
|
|
|
|
- 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
|