Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): calculate parallel jobs based on infrastructure needs #1475

Merged
merged 5 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/run-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
strategy:
matrix:
# Maintenance: disabled until we discover concurrency lock issue with multiple versions and tmp
# version: ["3.7", "3.8", "3.9"]
version: ["3.7"]
version: ["3.7", "3.8", "3.9"]
# version: ["3.7"]
steps:
- name: "Checkout"
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ unit-test:
poetry run pytest tests/unit

e2e-test:
poetry run pytest -rP -n auto --dist loadfile -o log_cli=true tests/e2e
python parallel_run_e2e.py

coverage-html:
poetry run pytest -m "not perf" --ignore tests/e2e --cov=aws_lambda_powertools --cov-report=html
Expand Down
16 changes: 16 additions & 0 deletions parallel_run_e2e.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
""" Calculate how many parallel workers are needed to complete E2E infrastructure jobs across available CPU Cores """
import subprocess
from pathlib import Path


def main():
features = Path("tests/e2e").rglob("infrastructure.py")
workers = len(list(features)) - 1

command = f"poetry run pytest -n {workers} --dist loadfile -o log_cli=true tests/e2e"
print(f"Running E2E tests with: {command}")
subprocess.run(command.split(), shell=False)


if __name__ == "__main__":
main()
15 changes: 15 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[tox]
envlist = py37,py38,py39

[testenv]
deps =
filelock
pytest-xdist
pydantic
email-validator

commands = python parallel_run_e2e.py

; If you ever encounter another parallel lock across interpreters
; pip install tox tox-poetry
; tox -p --parallel-live