Skip to content

Commit

Permalink
Reduced installed packages in tox and CI (#174)
Browse files Browse the repository at this point in the history
* Reduced installed packages in tox environments

* Reduced installed packages in CI workflows

* Removed libmemcached-dev package from CI workflows

* Removed Install dependencies step from CI workflows

* Moved tox-gh-actions to pyproject.toml from pip in CI workflows

* Increased examples CI workflows timeout from 5 -> 10 minutes

* Upgraded readthedocs from Python 3.11 -> 3.12
  • Loading branch information
Nusnus authored Jan 23, 2024
1 parent 9813a7e commit 85a79e0
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 47 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Run tests
working-directory: examples/myworker
timeout-minutes: 5
timeout-minutes: 10
run: |
pytest -vv tests -n auto
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
- name: Run tests
working-directory: examples/range
timeout-minutes: 5
timeout-minutes: 10
run: |
pytest -vv tests -n auto
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
- name: Run tests
working-directory: examples/rabbitmq_management
timeout-minutes: 5
timeout-minutes: 10
run: |
pytest -vv tests -n auto
Expand Down Expand Up @@ -155,7 +155,7 @@ jobs:
- name: Run tests
working-directory: examples/django
timeout-minutes: 5
timeout-minutes: 10
run: |
export DJANGO_SETTINGS_MODULE=proj.settings
pytest -vv tests -n auto
9 changes: 3 additions & 6 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,13 @@ jobs:
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox-gh-actions
- name: Install Poetry
uses: snok/install-poetry@v1.3.4

- name: Install CI dependencies
run: poetry install --only ci
run: |
poetry config virtualenvs.create false
poetry install --only ci
- name: Run check
run: tox -e ${{ matrix.check }}
16 changes: 4 additions & 12 deletions .github/workflows/parallel-support.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,22 @@ jobs:
if: startsWith(matrix.os, 'ubuntu-')
run: |
sudo apt update
sudo apt install -y libmemcached-dev
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: '**/setup.py'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox-gh-actions

- name: Install Poetry
if: startsWith(matrix.os, 'ubuntu-')
uses: snok/install-poetry@v1.3.4

- name: Install tox
run: |
poetry install --with ci
poetry config virtualenvs.create false
poetry install --only ci
- name: Run tox for all environments in parallel
timeout-minutes: 15
Expand All @@ -90,26 +86,22 @@ jobs:
if: startsWith(matrix.os, 'ubuntu-')
run: |
sudo apt update
sudo apt install -y libmemcached-dev
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: '**/setup.py'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox-gh-actions

- name: Install Poetry
if: startsWith(matrix.os, 'ubuntu-')
uses: snok/install-poetry@v1.3.4

- name: Install tox
run: |
poetry install --with ci
poetry config virtualenvs.create false
poetry install --only ci
- name: Run tox for all environments in parallel
timeout-minutes: 15
Expand Down
24 changes: 6 additions & 18 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,22 @@ jobs:
if: startsWith(matrix.os, 'ubuntu-')
run: |
sudo apt update
sudo apt install -y libmemcached-dev
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: '**/setup.py'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox-gh-actions

- name: Install Poetry
if: startsWith(matrix.os, 'ubuntu-')
uses: snok/install-poetry@v1.3.4

- name: Install tox
run: |
poetry install --with ci
poetry config virtualenvs.create false
poetry install --only ci
- name: Run tox for "${{ matrix.python-version }}-unit"
timeout-minutes: 5
Expand Down Expand Up @@ -99,26 +95,22 @@ jobs:
if: startsWith(matrix.os, 'ubuntu-')
run: |
sudo apt update
sudo apt install -y libmemcached-dev
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: '**/setup.py'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox-gh-actions

- name: Install Poetry
if: startsWith(matrix.os, 'ubuntu-')
uses: snok/install-poetry@v1.3.4

- name: Install tox
run: |
poetry install --with ci
poetry config virtualenvs.create false
poetry install --only ci
- name: Run tox for "${{ matrix.python-version }}-integration"
timeout-minutes: 15
Expand Down Expand Up @@ -148,26 +140,22 @@ jobs:
if: startsWith(matrix.os, 'ubuntu-')
run: |
sudo apt update
sudo apt install -y libmemcached-dev
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: '**/setup.py'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox-gh-actions

- name: Install Poetry
if: startsWith(matrix.os, 'ubuntu-')
uses: snok/install-poetry@v1.3.4

- name: Install tox
run: |
poetry install --with ci
poetry config virtualenvs.create false
poetry install --only ci
- name: Run tox for "${{ matrix.python-version }}-smoke"
timeout-minutes: 15
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3.12"
jobs:
post_create_environment:
# Install poetry
Expand Down
37 changes: 36 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ tox = [
{ version = "^3.0.0", python = "<3.8.1" },
{ version = "^4.0.0", python = ">=3.8.1,<4.0" },
]
tox-gh-actions = [
{ version = "^2.0.0", python = "<3.8.1" },
{ version = "^3.0.0", python = ">=3.8.1,<4.0" },
]

[tool.poetry.group.docs]
optional = true
Expand Down
14 changes: 9 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ setenv =
PYTHONUNBUFFERED = 1
PYTHONDONTWRITEBYTECODE = 1
commands_pre =
poetry install -E "celery" --with dev,test
poetry install -E "celery" --with test
commands =
unit: poetry run pytest tests/unit/ --maxfail=3 {posargs}
integration: poetry run pytest tests/integration/ --exitfirst --dist=loadscope {posargs}
Expand All @@ -35,21 +35,23 @@ basepython =
3.10: py310
3.11: py311
3.12: py312
pypy3: pypy3
mypy: py312
lint: py312
clean: py312
xdist: py312
parallel: py312
docs: py312
docs-livehtml: py312
docs-apidoc: py312
usedevelop = True

[testenv:xdist]
description = Run tests using {basepython} with xdist
setenv =
PYTHONUNBUFFERED = 1
PYTHONDONTWRITEBYTECODE = 1
commands_pre =
poetry install -E "celery" --with test
commands =
poetry run pytest tests --exitfirst \
-n auto --dist=loadscope \
Expand All @@ -61,6 +63,8 @@ description = Run unit, integration and smoke tests using {basepython} in parall
setenv =
PYTHONUNBUFFERED = 1
PYTHONDONTWRITEBYTECODE = 1
commands_pre =
poetry install -E "celery" --with test
commands =
tox -e py312-unit,py312-integration,py312-smoke -p auto -o -- --exitfirst \
-n auto --dist=loadscope \
Expand All @@ -70,7 +74,7 @@ commands =
[testenv:mypy]
description = Run mypy using {basepython}
commands_pre =
poetry install -E "celery" --only dev
poetry install --only dev
poetry run mypy --install-types --non-interactive
commands =
poetry run mypy --config-file pyproject.toml
Expand All @@ -90,9 +94,9 @@ commands =
description = Clean up build and test artifacts using {basepython}
allowlist_externals = poetry, pytest, bash, find, make
commands_pre =
poetry install -E "celery" --only dev
pip install -U cleanpy
commands =
poetry run cleanpy .
cleanpy .
make -C ./docs clean
bash -c 'files=$(find . -name "*.coverage*" -type f); if [ -n "$files" ]; then echo "Removed coverage file(s):"; echo "$files" | tr " " "\n"; rm $files; fi'
bash -c 'containers=$(docker ps -aq --filter label=creator=pytest-docker-tools); if [ -n "$containers" ]; then echo "Removed Docker container(s):"; docker rm -f $containers; fi'
Expand Down

0 comments on commit 85a79e0

Please sign in to comment.