Skip to content

chore: clean-up circleci validate #631

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

Merged
merged 1 commit into from
Feb 24, 2025
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
2 changes: 0 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ jobs:

- run: uv run --frozen pre-commit run --show-diff-on-failure --color=always --all-files --source ${{ github.event.pull_request.base.sha || github.event.before }} --origin ${{ github.event.pull_request.head.sha || github.event.after }}
shell: bash
env:
SKIP: circleci_validate

- uses: stefanzweifel/git-auto-commit-action@v5
# Always commit changes even if pre-commit failed
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ ARG CODEGEN_BOT_GHE_TOKEN=""
FROM ghcr.io/astral-sh/uv:python${PYTHON_VERSION}-bookworm-slim AS base_uv
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
ENV GITHUB_WORKSPACE=/workspace
LABEL com.circleci.preserve-entrypoint=true
## Change the working directory to the `codegen-sdk` directory
FROM base_uv AS install-tools
RUN apt-get update && apt-get install -y build-essential curl git
Expand Down
51 changes: 0 additions & 51 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
from pathlib import Path

import pytest

Expand Down Expand Up @@ -66,28 +65,6 @@ def pytest_addoption(parser) -> None:
parser.addoption("--cli-api-key", action="store", type=str, default=None, help="Token necessary to access skills.")


# content of conftest.py
# def pytest_configure(config) -> None:
# worker_id = os.environ.get("PYTEST_XDIST_WORKER")
# if worker_id is not None:
# os.makedirs("build/logs", exist_ok=True)
# logging.basicConfig(
# format=config.getini("log_file_format"),
# filename=f"build/logs/tests_{worker_id}.log",
# level=config.getini("log_file_level"),
# )


def is_git_lfs_pointer(file_path: Path) -> bool:
"""Check if a file is a git LFS pointer file"""
try:
with open(file_path) as f:
first_line = f.readline().strip()
return first_line == "version https://git-lfs.github.com/spec/v1"
except Exception:
return False


@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
Expand All @@ -97,31 +74,3 @@ def pytest_runtest_makereport(item, call):
if "NodeJS or npm is not installed" in str(report.longrepr):
msg = "This test requires NodeJS and npm to be installed. Please install them before running the tests."
raise RuntimeError(msg)


# Lets not run if we are in CI


IS_CI = os.getenv("CI") == "true" or os.getenv("CIRCLECI") == "true"


@pytest.fixture(autouse=IS_CI)
def skip_lfs_tests(request) -> None:
"""Skip tests that depend on git LFS files if they haven't been pulled"""
# Get the test module path
test_path = Path(request.module.__file__)

# Only run for integration tests
try:
cwd = Path.cwd()
except FileNotFoundError:
return
if not str(test_path).startswith(str(cwd / "tests" / "integration")):
return

try:
expected = request.getfixturevalue("expected")
if isinstance(expected, Path) and is_git_lfs_pointer(expected):
pytest.skip(f"Test requires git LFS file {expected} which hasn't been pulled")
except Exception:
pass
Loading