2020-11-06 17:46:25 +00:00
|
|
|
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
|
|
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
|
|
|
|
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2020-11-06 18:19:05 +00:00
|
|
|
# branches: [ $default-branch ]
|
|
|
|
# pull_request:
|
|
|
|
# branches: [ $default-branch ]
|
2020-11-06 17:46:25 +00:00
|
|
|
|
2020-11-06 18:55:27 +00:00
|
|
|
env:
|
2020-11-17 19:50:13 +00:00
|
|
|
DEFAULT_PYTHON: 3.7
|
2020-11-06 19:03:45 +00:00
|
|
|
PLEXAPI_AUTH_SERVER_BASEURL: http://127.0.0.1:32400
|
|
|
|
PLEX_CONTAINER_TAG: latest
|
2020-11-06 18:55:27 +00:00
|
|
|
|
2020-11-06 17:46:25 +00:00
|
|
|
jobs:
|
2020-11-17 19:50:13 +00:00
|
|
|
lint-flake8:
|
|
|
|
name: Check flake8
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
pip install -U pip
|
|
|
|
pip install -r requirements_dev.txt
|
|
|
|
pip install -e .
|
|
|
|
- name: Lint with flake8
|
|
|
|
run: |
|
|
|
|
# stop the build if there are Python syntax errors or undefined names
|
2020-11-17 20:20:35 +00:00
|
|
|
flake8 plexapi --count --select=E9,F63,F7,F82 --show-source --statistics
|
2020-11-17 19:50:13 +00:00
|
|
|
# The GitHub editor is 127 chars wide
|
2020-11-17 20:25:41 +00:00
|
|
|
flake8 plexapi --count --max-complexity=12 --max-line-length=127 --statistics
|
2020-11-06 17:46:25 +00:00
|
|
|
|
2020-11-17 20:40:45 +00:00
|
|
|
pytest-unclaimed:
|
|
|
|
name: pytest (unclaimed)
|
2020-11-17 21:56:34 +00:00
|
|
|
needs: lint-flake8
|
2020-11-06 17:46:25 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2020-11-06 18:55:27 +00:00
|
|
|
# python-version: [3.5, 3.6, 3.7, 3.8]
|
|
|
|
python-version: [3.6]
|
2020-11-06 17:46:25 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2020-11-17 19:50:13 +00:00
|
|
|
pip install -U pip
|
|
|
|
pip install -r requirements_dev.txt
|
2020-11-06 19:46:06 +00:00
|
|
|
pip install -e .
|
2020-11-06 18:55:27 +00:00
|
|
|
- name: Test with unclaimed Plex server
|
|
|
|
env:
|
2020-11-06 19:03:45 +00:00
|
|
|
PLEXAPI_HEADER_PROVIDES: 'controller,sync-target'
|
|
|
|
PLEXAPI_HEADER_PLATFORM: iOS
|
|
|
|
PLEXAPI_HEADER_PLATFORM_VERSION: 11.4.1
|
|
|
|
PLEXAPI_HEADER_DEVICE: iPhone
|
2020-11-17 20:40:45 +00:00
|
|
|
TEST_ACCOUNT_ONCE: 1
|
2020-11-06 17:46:25 +00:00
|
|
|
run: |
|
2020-11-06 18:55:27 +00:00
|
|
|
# Set up docker PMS instance
|
|
|
|
python \
|
|
|
|
-u tools/plex-bootstraptest.py \
|
|
|
|
--destination plex \
|
|
|
|
--advertise-ip=127.0.0.1 \
|
|
|
|
--bootstrap-timeout 540 \
|
2020-11-06 19:50:40 +00:00
|
|
|
--docker-tag ${{ env.PLEX_CONTAINER_TAG }} \
|
2020-11-06 18:55:27 +00:00
|
|
|
--unclaimed
|
|
|
|
# Run main tests
|
|
|
|
pytest \
|
|
|
|
-rxXs \
|
|
|
|
--ignore=tests/test_sync.py \
|
|
|
|
--tb=native \
|
2020-11-17 18:14:43 +00:00
|
|
|
--verbose \
|
2020-11-06 18:55:27 +00:00
|
|
|
--cov-config .coveragerc \
|
|
|
|
--cov=plexapi \
|
|
|
|
tests
|
|
|
|
# Run sync tests
|
|
|
|
pytest \
|
|
|
|
-rxXs \
|
|
|
|
--tb=native \
|
|
|
|
--verbose \
|
|
|
|
--cov-config .coveragerc \
|
|
|
|
--cov=plexapi \
|
2020-11-17 18:14:43 +00:00
|
|
|
--cov-append \
|
2020-11-06 18:55:27 +00:00
|
|
|
tests/test_sync.py
|
2020-11-17 20:40:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
pytest-claimed:
|
|
|
|
name: pytest (claimed)
|
2020-11-17 21:56:34 +00:00
|
|
|
needs: pytest-unclaimed
|
2020-11-17 20:40:45 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
# python-version: [3.5, 3.6, 3.7, 3.8]
|
|
|
|
python-version: [3.6]
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
pip install -U pip
|
|
|
|
pip install -r requirements_dev.txt
|
|
|
|
pip install -e .
|
|
|
|
- name: Test with claimed Plex server
|
|
|
|
env:
|
|
|
|
PLEXAPI_HEADER_PROVIDES: 'controller,sync-target'
|
|
|
|
PLEXAPI_HEADER_PLATFORM: iOS
|
|
|
|
PLEXAPI_HEADER_PLATFORM_VERSION: 11.4.1
|
|
|
|
PLEXAPI_HEADER_DEVICE: iPhone
|
|
|
|
run: |
|
|
|
|
# Set up docker PMS instance
|
|
|
|
python \
|
|
|
|
-u tools/plex-bootstraptest.py \
|
|
|
|
--destination plex \
|
|
|
|
--advertise-ip=127.0.0.1 \
|
|
|
|
--bootstrap-timeout 540 \
|
|
|
|
--docker-tag ${{ env.PLEX_CONTAINER_TAG }}
|
|
|
|
# Run main tests
|
|
|
|
pytest \
|
|
|
|
-rxXs \
|
|
|
|
--ignore=tests/test_sync.py \
|
|
|
|
--tb=native \
|
|
|
|
--verbose \
|
|
|
|
--cov-config .coveragerc \
|
|
|
|
--cov=plexapi \
|
|
|
|
tests
|
|
|
|
# Run sync tests
|
|
|
|
pytest \
|
|
|
|
-rxXs \
|
|
|
|
--tb=native \
|
|
|
|
--verbose \
|
|
|
|
--cov-config .coveragerc \
|
|
|
|
--cov=plexapi \
|
|
|
|
--cov-append \
|
|
|
|
tests/test_sync.py
|