mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-22 11:43:13 +00:00
Pin dependencies, create and cache venvs
This commit is contained in:
parent
81f7f9a6fc
commit
9dd13c8872
2 changed files with 94 additions and 38 deletions
103
.github/workflows/ci.yaml
vendored
103
.github/workflows/ci.yaml
vendored
|
@ -13,8 +13,44 @@ env:
|
|||
DEFAULT_PYTHON: 3.7
|
||||
|
||||
jobs:
|
||||
prepare-venv:
|
||||
name: Prepare Python ${{ matrix.python-version }} virtual environment
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.6, 3.7, 3.8, 3.9]
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
id: python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Restore Python virtual environment
|
||||
id: cache-venv
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: venv
|
||||
key: ${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{ steps.python.outputs.python-version }}-${{ hashFiles('requirements_dev.txt') }}
|
||||
restore-keys: |
|
||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{ steps.python.outputs.python-version }}-
|
||||
|
||||
- name: Create Python virtual environment
|
||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
python -m venv venv
|
||||
. venv/bin/activate
|
||||
pip install -U pip
|
||||
pip install -r requirements_dev.txt
|
||||
pip install -e .
|
||||
|
||||
|
||||
lint-flake8:
|
||||
name: Check flake8
|
||||
needs: prepare-venv
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code from Github
|
||||
|
@ -25,16 +61,23 @@ jobs:
|
|||
with:
|
||||
python-version: ${{ env.DEFAULT_PYTHON }}
|
||||
|
||||
- name: Cache dependencies
|
||||
- name: Restore Python ${{ env.DEFAULT_PYTHON }} virtual environment
|
||||
id: cache-venv
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-pip-flake8
|
||||
path: venv
|
||||
key: >-
|
||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{
|
||||
steps.python.outputs.python-version }}-${{
|
||||
hashFiles('requirements_dev.txt') }}
|
||||
restore-keys: |
|
||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{ steps.python.outputs.python-version }}-
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Fail job if Python cache restore failed
|
||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
pip install -U pip
|
||||
pip install flake8
|
||||
echo "Failed to restore Python virtual environment from cache"
|
||||
exit 1
|
||||
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
|
@ -67,22 +110,28 @@ jobs:
|
|||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
id: python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Cache dependencies
|
||||
- name: Restore Python ${{ env.DEFAULT_PYTHON }} virtual environment
|
||||
id: cache-venv
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements_dev.txt') }}
|
||||
restore-keys: ${{ runner.os }}-${{ matrix.python-version }}-pip-
|
||||
path: venv
|
||||
key: >-
|
||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{
|
||||
steps.python.outputs.python-version }}-${{
|
||||
hashFiles('requirements_dev.txt') }}
|
||||
restore-keys: |
|
||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{ steps.python.outputs.python-version }}-
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Fail job if Python cache restore failed
|
||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
pip install -U pip
|
||||
pip install -r requirements_dev.txt
|
||||
pip install -e .
|
||||
echo "Failed to restore Python virtual environment from cache"
|
||||
exit 1
|
||||
|
||||
- name: Get PMS Docker image digest
|
||||
id: docker-digest
|
||||
|
@ -186,21 +235,29 @@ jobs:
|
|||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-pip-coverage
|
||||
|
||||
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
|
||||
id: python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ env.DEFAULT_PYTHON }}
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Restore Python ${{ env.DEFAULT_PYTHON }} virtual environment
|
||||
id: cache-venv
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: venv
|
||||
key: >-
|
||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{
|
||||
steps.python.outputs.python-version }}-${{
|
||||
hashFiles('requirements_dev.txt') }}
|
||||
restore-keys: |
|
||||
${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{ steps.python.outputs.python-version }}-
|
||||
|
||||
- name: Fail job if Python cache restore failed
|
||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
pip install -U pip
|
||||
pip install coverage
|
||||
echo "Failed to restore Python virtual environment from cache"
|
||||
exit 1
|
||||
|
||||
- name: Download all coverage artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
|
|
|
@ -2,19 +2,18 @@
|
|||
# PlexAPI requirements to run py.test.
|
||||
# pip install -r requirements_dev.txt
|
||||
#---------------------------------------------------------
|
||||
coveralls
|
||||
flake8
|
||||
pillow
|
||||
pytest
|
||||
pytest-cache
|
||||
pytest-cov
|
||||
coveralls==2.2.0
|
||||
flake8==3.8.4
|
||||
pillow==8.0.1
|
||||
pytest==6.1.2
|
||||
pytest-cache==1.0
|
||||
pytest-cov==2.10.1
|
||||
pytest-mock<=1.11.1
|
||||
recommonmark
|
||||
requests
|
||||
requests-mock
|
||||
sphinx
|
||||
sphinxcontrib-napoleon
|
||||
sphinx-rtd-theme
|
||||
tqdm
|
||||
websocket-client
|
||||
mock; python_version < '3.3'
|
||||
recommonmark==0.6.0
|
||||
requests==2.25.0
|
||||
requests-mock==1.8.0
|
||||
sphinx==3.3.1
|
||||
sphinxcontrib-napoleon==0.7
|
||||
sphinx-rtd-theme==0.5.0
|
||||
tqdm==4.54.0
|
||||
websocket-client==0.57.0
|
||||
|
|
Loading…
Reference in a new issue