diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d87a3a8be..1b3eee829 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,6 +81,7 @@ jobs: - uses: actions/checkout@v4 with: persist-credentials: false + fetch-depth: 0 # Needed to fetch the version from git - uses: actions/setup-python@v4 with: python-version: "3.13" diff --git a/.gitignore b/.gitignore index 695d6f9ef..2203266da 100644 --- a/.gitignore +++ b/.gitignore @@ -60,6 +60,7 @@ var/ *.egg-info/ .installed.cfg *.egg +esrally/_version.py # hatch-vcs # PyInstaller # Usually these files are written by a python script from a template diff --git a/Makefile b/Makefile index 9d7dd6a57..eb549bb95 100644 --- a/Makefile +++ b/Makefile @@ -203,11 +203,11 @@ it: venv $(MAKE) test ARGS=$(or $(ARGS),it/) # It runs serverless integration tests. -it_serverless: install_pytest_rally_plugin +it_serverless: venv install_pytest_rally_plugin uv run -- pytest -s --log-cli-level=$(LOG_CI_LEVEL) --track-repository-test-directory=it_tracks_serverless it/track_repo_compatibility $(ARGS) # It runs rally_tracks_compat integration tests. -it_tracks_compat: install_pytest_rally_plugin +it_tracks_compat: venv install_pytest_rally_plugin uv run -- pytest -s --log-cli-level=$(LOG_CI_LEVEL) it/track_repo_compatibility $(ARGS) # It runs benchmark tests. diff --git a/docker/Dockerfiles/dev/Dockerfile b/docker/Dockerfiles/dev/Dockerfile index 15c4ebfba..92a5eceb6 100644 --- a/docker/Dockerfiles/dev/Dockerfile +++ b/docker/Dockerfiles/dev/Dockerfile @@ -38,12 +38,12 @@ COPY --from=ghcr.io/astral-sh/uv:0.8.22 /uv /uvx /bin/ USER 1000 -COPY Makefile /rally/ -COPY README.md /rally/ -COPY .ci/variables.json /rally/.ci/ -COPY esrally/ /rally/esrally/ -COPY pyproject.toml /rally/ -COPY uv.lock /rally/ +COPY --chown=1000:0 Makefile /rally/ +COPY --chown=1000:0 README.md /rally/ +COPY --chown=1000:0 .ci/variables.json /rally/.ci/ +COPY --chown=1000:0 esrally/ /rally/esrally/ +COPY --chown=1000:0 pyproject.toml /rally/ +COPY --chown=1000:0 uv.lock /rally/ ENV VIRTUAL_ENV=/rally/venv ENV PATH=/rally/venv/bin:$PATH @@ -52,6 +52,7 @@ ENV UV_PROJECT_ENVIRONMENT=/rally/venv # Wipe away any lingering caches, copied over from the local machine RUN find /rally -name "__pycache__" -exec rm -rf -- \{\} \; 2>/dev/null || true RUN find /rally -name ".pyc" -exec rm -rf -- \{\} \; 2>/dev/null || true +ENV SETUPTOOLS_SCM_PRETEND_VERSION=${RALLY_VERSION} RUN make install LABEL org.label-schema.schema-version="1.0" \ diff --git a/esrally/_version.py b/esrally/_version.py deleted file mode 100644 index 930e2cd68..000000000 --- a/esrally/_version.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "2.13.0" diff --git a/pyproject.toml b/pyproject.toml index 33f106760..a4acfa2d8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,13 @@ [build-system] -requires = ["hatchling"] +requires = ["hatchling", "hatch-vcs"] build-backend = "hatchling.build" [tool.hatch.version] -path = "esrally/_version.py" +source = "vcs" +[tool.hatch.version.raw-options] +local_scheme = "no-local-version" +[tool.hatch.build.hooks.vcs] +version-file = "esrally/_version.py" [tool.hatch.metadata] allow-direct-references = true @@ -166,7 +170,7 @@ profile = 'black' # set to true for more verbose output of tests log_cli = false log_level = "INFO" -addopts = "--verbose --color=yes" +addopts = "--verbose --color=yes --import-mode=importlib" testpaths = "tests" junit_family = "xunit2" junit_logging = "all"