mirror of
https://github.com/pkkid/python-plexapi
synced 2025-02-16 21:08:27 +00:00
Test more versions, improve readability
This commit is contained in:
parent
edde547919
commit
561a664362
1 changed files with 24 additions and 3 deletions
27
.github/workflows/ci.yaml
vendored
27
.github/workflows/ci.yaml
vendored
|
@ -20,20 +20,24 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
|
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.DEFAULT_PYTHON }}
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
||||||
|
|
||||||
- name: Cache dependencies
|
- name: Cache dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/pip
|
path: ~/.cache/pip
|
||||||
key: ${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-pip-${{ hashFiles('requirements_dev.txt') }}
|
key: ${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-pip-${{ hashFiles('requirements_dev.txt') }}
|
||||||
restore-keys: ${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-pip
|
restore-keys: ${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-pip
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
pip install -U pip
|
pip install -U pip
|
||||||
pip install flake8
|
pip install flake8
|
||||||
|
|
||||||
- name: Lint with flake8
|
- name: Lint with flake8
|
||||||
run: |
|
run: |
|
||||||
# stop the build if there are Python syntax errors or undefined names
|
# stop the build if there are Python syntax errors or undefined names
|
||||||
|
@ -41,8 +45,9 @@ jobs:
|
||||||
# The GitHub editor is 127 chars wide
|
# The GitHub editor is 127 chars wide
|
||||||
flake8 plexapi --count --max-complexity=12 --max-line-length=127 --statistics
|
flake8 plexapi --count --max-complexity=12 --max-line-length=127 --statistics
|
||||||
|
|
||||||
|
|
||||||
pytest:
|
pytest:
|
||||||
name: pytest (${{ matrix.python-version }}-${{ matrix.plex }})
|
name: pytest ${{ matrix.python-version }} (${{ matrix.plex }})
|
||||||
needs: lint-flake8
|
needs: lint-flake8
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
|
@ -50,7 +55,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
python-version: [3.6, 3.7]
|
python-version: [3.6, 3.7, 3.8, 3.9]
|
||||||
plex: ['unclaimed', 'claimed']
|
plex: ['unclaimed', 'claimed']
|
||||||
is-master:
|
is-master:
|
||||||
- ${{ github.ref == 'refs/heads/master' }}
|
- ${{ github.ref == 'refs/heads/master' }}
|
||||||
|
@ -59,27 +64,32 @@ jobs:
|
||||||
plex: claimed
|
plex: claimed
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
- name: Cache dependencies
|
- name: Cache dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/pip
|
path: ~/.cache/pip
|
||||||
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements_dev.txt') }}
|
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements_dev.txt') }}
|
||||||
restore-keys: ${{ runner.os }}-${{ matrix.python-version }}-pip
|
restore-keys: ${{ runner.os }}-${{ matrix.python-version }}-pip
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
pip install -U pip
|
pip install -U pip
|
||||||
pip install -r requirements_dev.txt
|
pip install -r requirements_dev.txt
|
||||||
pip install -e .
|
pip install -e .
|
||||||
|
|
||||||
- name: Set Plex credentials
|
- name: Set Plex credentials
|
||||||
if: matrix.plex == 'claimed'
|
if: matrix.plex == 'claimed'
|
||||||
run: |
|
run: |
|
||||||
echo "PLEXAPI_AUTH_MYPLEX_USERNAME=${{ secrets.PLEXAPI_AUTH_MYPLEX_USERNAME }}" > $GITHUB_ENV
|
echo "PLEXAPI_AUTH_MYPLEX_USERNAME=${{ secrets.PLEXAPI_AUTH_MYPLEX_USERNAME }}" > $GITHUB_ENV
|
||||||
echo "PLEXAPI_AUTH_MYPLEX_PASSWORD=${{ secrets.PLEXAPI_AUTH_MYPLEX_PASSWORD }}" >> $GITHUB_ENV
|
echo "PLEXAPI_AUTH_MYPLEX_PASSWORD=${{ secrets.PLEXAPI_AUTH_MYPLEX_PASSWORD }}" >> $GITHUB_ENV
|
||||||
- name: Bootstrap Plex server (${{ matrix.plex }})
|
|
||||||
|
- name: Bootstrap ${{ matrix.plex }} Plex server
|
||||||
run: |
|
run: |
|
||||||
python \
|
python \
|
||||||
-u tools/plex-bootstraptest.py \
|
-u tools/plex-bootstraptest.py \
|
||||||
|
@ -88,6 +98,7 @@ jobs:
|
||||||
--bootstrap-timeout 540 \
|
--bootstrap-timeout 540 \
|
||||||
--docker-tag ${{ env.PLEX_CONTAINER_TAG }} \
|
--docker-tag ${{ env.PLEX_CONTAINER_TAG }} \
|
||||||
--${{ matrix.plex }}
|
--${{ matrix.plex }}
|
||||||
|
|
||||||
- name: Main tests with ${{ matrix.plex }} server
|
- name: Main tests with ${{ matrix.plex }} server
|
||||||
env:
|
env:
|
||||||
TEST_ACCOUNT_ONCE: ${{ matrix.plex == 'unclaimed' }}
|
TEST_ACCOUNT_ONCE: ${{ matrix.plex == 'unclaimed' }}
|
||||||
|
@ -99,6 +110,7 @@ jobs:
|
||||||
--verbose \
|
--verbose \
|
||||||
--cov=plexapi \
|
--cov=plexapi \
|
||||||
tests
|
tests
|
||||||
|
|
||||||
- name: Sync tests with ${{ matrix.plex }} server
|
- name: Sync tests with ${{ matrix.plex }} server
|
||||||
if: matrix.plex == 'claimed'
|
if: matrix.plex == 'claimed'
|
||||||
env:
|
env:
|
||||||
|
@ -114,15 +126,18 @@ jobs:
|
||||||
--cov=plexapi \
|
--cov=plexapi \
|
||||||
--cov-append \
|
--cov-append \
|
||||||
tests/test_sync.py
|
tests/test_sync.py
|
||||||
|
|
||||||
- name: Unlink PMS from MyPlex account
|
- name: Unlink PMS from MyPlex account
|
||||||
if: matrix.plex == 'claimed' && always()
|
if: matrix.plex == 'claimed' && always()
|
||||||
run: python -u tools/plex-teardowntest.py
|
run: python -u tools/plex-teardowntest.py
|
||||||
|
|
||||||
- name: Upload coverage artifact
|
- name: Upload coverage artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: coverage-${{ matrix.plex }}-${{ matrix.python-version }}
|
name: coverage-${{ matrix.plex }}-${{ matrix.python-version }}
|
||||||
path: .coverage
|
path: .coverage
|
||||||
|
|
||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
name: Process test coverage
|
name: Process test coverage
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -130,26 +145,32 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code from GitHub
|
- name: Check out code from GitHub
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Cache dependencies
|
- name: Cache dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/pip
|
path: ~/.cache/pip
|
||||||
key: ${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-pip-${{ hashFiles('requirements_dev.txt') }}
|
key: ${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-pip-${{ hashFiles('requirements_dev.txt') }}
|
||||||
restore-keys: ${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-pip
|
restore-keys: ${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-pip
|
||||||
|
|
||||||
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
|
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.DEFAULT_PYTHON }}
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
pip install -U pip
|
pip install -U pip
|
||||||
pip install coverage
|
pip install coverage
|
||||||
|
|
||||||
- name: Download all coverage artifacts
|
- name: Download all coverage artifacts
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v2
|
||||||
|
|
||||||
- name: Combine coverage results
|
- name: Combine coverage results
|
||||||
run: |
|
run: |
|
||||||
coverage combine coverage*/.coverage*
|
coverage combine coverage*/.coverage*
|
||||||
coverage report --fail-under=50
|
coverage report --fail-under=50
|
||||||
coverage xml
|
coverage xml
|
||||||
|
|
||||||
- name: Upload coverage to Codecov
|
- name: Upload coverage to Codecov
|
||||||
uses: codecov/codecov-action@v1
|
uses: codecov/codecov-action@v1
|
||||||
|
|
Loading…
Add table
Reference in a new issue