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-12-02 03:40:07 +00:00
|
|
|
branches: [ $default-branch ]
|
2020-11-18 02:48:31 +00:00
|
|
|
pull_request:
|
2020-12-02 03:40:07 +00:00
|
|
|
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:
|
2020-11-18 02:35:03 +00:00
|
|
|
name: pytest ${{ matrix.python-version }} (unclaimed)
|
2020-11-17 21:56:34 +00:00
|
|
|
needs: lint-flake8
|
2020-11-06 17:46:25 +00:00
|
|
|
runs-on: ubuntu-latest
|
2020-12-02 03:21:00 +00:00
|
|
|
env:
|
|
|
|
TEST_ACCOUNT_ONCE: 1
|
2020-11-06 17:46:25 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2020-11-06 18:55:27 +00:00
|
|
|
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-12-02 03:21:00 +00:00
|
|
|
- name: Bootstrap Plex server
|
2020-11-06 17:46:25 +00:00
|
|
|
run: |
|
2020-11-06 18:55:27 +00:00
|
|
|
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
|
2020-12-02 03:21:00 +00:00
|
|
|
- name: Main tests with unclaimed server
|
|
|
|
run: |
|
2020-11-06 18:55:27 +00:00
|
|
|
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=plexapi \
|
|
|
|
tests
|
2020-12-02 03:21:00 +00:00
|
|
|
- name: Sync tests with unclaimed server
|
|
|
|
env:
|
|
|
|
PLEXAPI_HEADER_PROVIDES: 'controller,sync-target'
|
|
|
|
PLEXAPI_HEADER_PLATFORM: iOS
|
|
|
|
PLEXAPI_HEADER_PLATFORM_VERSION: 11.4.1
|
|
|
|
PLEXAPI_HEADER_DEVICE: iPhone
|
|
|
|
run: |
|
2020-11-06 18:55:27 +00:00
|
|
|
pytest \
|
|
|
|
-rxXs \
|
|
|
|
--tb=native \
|
|
|
|
--verbose \
|
|
|
|
--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-12-02 03:21:00 +00:00
|
|
|
- name: Upload coverage artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: coverage-${{ matrix.python-version }}-unclaimed
|
|
|
|
path: .coverage
|
2020-11-17 20:40:45 +00:00
|
|
|
|
|
|
|
pytest-claimed:
|
2020-11-18 02:35:03 +00:00
|
|
|
name: pytest (claimed)
|
2020-11-17 21:56:34 +00:00
|
|
|
needs: pytest-unclaimed
|
2020-11-18 02:28:06 +00:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2020-11-17 20:40:45 +00:00
|
|
|
runs-on: ubuntu-latest
|
2020-12-02 03:21:00 +00:00
|
|
|
env:
|
|
|
|
PLEXAPI_AUTH_MYPLEX_USERNAME: ${{ secrets.PLEXAPI_AUTH_MYPLEX_USERNAME }}
|
|
|
|
PLEXAPI_AUTH_MYPLEX_PASSWORD: ${{ secrets.PLEXAPI_AUTH_MYPLEX_PASSWORD }}
|
2020-11-17 20:40:45 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
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 .
|
2020-12-02 03:21:00 +00:00
|
|
|
- name: Bootstrap Plex server
|
2020-11-17 20:40:45 +00:00
|
|
|
run: |
|
|
|
|
python \
|
|
|
|
-u tools/plex-bootstraptest.py \
|
|
|
|
--destination plex \
|
|
|
|
--advertise-ip=127.0.0.1 \
|
|
|
|
--bootstrap-timeout 540 \
|
|
|
|
--docker-tag ${{ env.PLEX_CONTAINER_TAG }}
|
2020-12-02 03:21:00 +00:00
|
|
|
- name: Test with claimed Plex server
|
|
|
|
run: |
|
2020-11-17 20:40:45 +00:00
|
|
|
pytest \
|
|
|
|
-rxXs \
|
|
|
|
--ignore=tests/test_sync.py \
|
|
|
|
--tb=native \
|
|
|
|
--verbose \
|
|
|
|
--cov=plexapi \
|
|
|
|
tests
|
2020-12-02 03:21:00 +00:00
|
|
|
- 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: |
|
2020-11-17 20:40:45 +00:00
|
|
|
pytest \
|
|
|
|
-rxXs \
|
|
|
|
--tb=native \
|
|
|
|
--verbose \
|
|
|
|
--cov=plexapi \
|
|
|
|
--cov-append \
|
|
|
|
tests/test_sync.py
|
2020-12-02 03:40:07 +00:00
|
|
|
- name: Unlink PMS from MyPlex account
|
|
|
|
run: python -u tools/plex-teardowntest.py
|
2020-12-02 03:21:00 +00:00
|
|
|
- name: Upload coverage artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: coverage-${{ matrix.python-version }}-claimed
|
|
|
|
path: .coverage
|
|
|
|
|
|
|
|
coverage:
|
|
|
|
name: Process test coverage
|
|
|
|
runs-on: ubuntu-latest
|
2020-12-02 03:22:23 +00:00
|
|
|
needs: pytest-unclaimed
|
2020-12-02 03:21:00 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
python-version: [3.7]
|
|
|
|
steps:
|
|
|
|
- name: Check out code from GitHub
|
|
|
|
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 coverage
|
|
|
|
- name: Download all coverage artifacts
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
- name: Combine coverage results
|
|
|
|
run: |
|
|
|
|
coverage combine coverage*/.coverage*
|
|
|
|
coverage report --fail-under=50
|
|
|
|
coverage xml
|
|
|
|
- name: Upload coverage to Codecov
|
|
|
|
uses: codecov/codecov-action@v1
|