Skip to content

Commit

Permalink
Update integration run for py3.14
Browse files Browse the repository at this point in the history
  • Loading branch information
vemel committed Dec 19, 2024
1 parent cf63d21 commit 5615ffe
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/aio_sanity_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ jobs:
--no-smart-version
- name: Check output
run: |
uv run ./scripts/check_output.py -p ./mypy_boto3_output --threads 10
uv run ./scripts/check_output.py -p ./mypy_boto3_output --threads 4
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ jobs:
version: "latest"
- name: Check output
run: |
uv run scripts/check_output.py -p ./mypy_boto3_output -d --threads 10
uv run scripts/check_output.py -p ./mypy_boto3_output -d --threads 4
2 changes: 1 addition & 1 deletion .github/workflows/integration_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ jobs:
--no-smart-version
- name: Check output
run: |
uv run ./scripts/check_output.py -p ./mypy_boto3_output --threads 10
uv run ./scripts/check_output.py -p ./mypy_boto3_output --threads 4
2 changes: 1 addition & 1 deletion .github/workflows/sanity_boto3_stubs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ jobs:
--no-smart-version
- name: Check output
run: |
uv run ./scripts/check_output.py -p ./mypy_boto3_output --threads 10
uv run ./scripts/check_output.py -p ./mypy_boto3_output --threads 4
2 changes: 1 addition & 1 deletion .github/workflows/sanity_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ jobs:
--no-smart-version
- name: Check output
run: |
uv run ./scripts/check_output.py -p ./mypy_boto3_output --threads 10
uv run ./scripts/check_output.py -p ./mypy_boto3_output --threads 4
24 changes: 18 additions & 6 deletions scripts/check_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,13 @@ def run_pyright(path: Path) -> None:

temp_path = Path(f.name)
output = temp_path.read_text()
try:
output_data = json.loads(output)
except json.JSONDecodeError:
Config.logger.error("Pyright output is not a valid JSON")
return

data = json.loads(output).get("generalDiagnostics", [])
data = output_data.get("generalDiagnostics", [])
errors: list[dict[str, Any]] = []
for error in data:
message = error.get("message", "")
Expand Down Expand Up @@ -423,7 +428,6 @@ def run_checks(path: Path) -> None:
run_call(path)
logger.debug(f"Running import for {relative_path} ...")
run_import(path)
logger.info(f"Finished {relative_path} ...")


def get_package_paths() -> tuple[Path, ...]:
Expand Down Expand Up @@ -451,16 +455,16 @@ def get_package_paths() -> tuple[Path, ...]:
return tuple(result)


def is_run_checks_passed(path: Path) -> bool:
def is_run_checks_passed(path: Path) -> tuple[Path, bool]:
"""
Run checks and return True if passed.
"""
try:
run_checks(path)
except CheckError as e:
Config.logger.warning(e)
return False
return True
return path, False
return path, True


def main() -> None:
Expand All @@ -474,14 +478,22 @@ def main() -> None:
logger = Config.logger
has_errors = False
package_paths = get_package_paths()
if not package_paths:
logger.error(f"No packages found if {args.path}")

pyright_config_path = ROOT_PATH / "pyrightconfig.json"
shutil.copyfile(PYRIGHT_CONFIG_PATH, pyright_config_path)

if args.threads > 1:
total = len(package_paths)
with ThreadPoolExecutor(max_workers=args.threads) as executor:
results = executor.map(is_run_checks_passed, package_paths)
for is_passed in results:
for index, pair in enumerate(results):
path, is_passed = pair
logger.info(
f"[{index + 1:<03}/{total:<03}] Finished"
f" {path.absolute().relative_to(Path.cwd())} ..."
)
has_errors = has_errors or not is_passed
if not is_passed and args.exit_on_error:
break
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

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

0 comments on commit 5615ffe

Please sign in to comment.