diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c147272..878aa84 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -19,7 +19,7 @@ env: jobs: test: - name: Test Python ${{ matrix.py }} - KubeRay ${{ matrix.kuberay }} + name: Test Python ${{ matrix.py }} - Ray ${{ matrix.kuberay }} - Dagster ${{ matrix.dagster }} - KubeRay ${{ matrix.kuberay }} runs-on: ${{ matrix.os }}-latest strategy: fail-fast: false @@ -31,6 +31,13 @@ jobs: - "3.11" - "3.10" - "3.9" + ray: + - "2.37.0" + - "2.24.0" + - "2.12.0" + dagster: + - "1.8.12" + - "1.7.16" kuberay: - "1.1.0" - "1.2.2" @@ -57,10 +64,12 @@ jobs: - name: Run tests env: PYTEST_KUBERAY_VERSIONS: "${{ matrix.kuberay }}" + PYTEST_RAY_VERSION: "${{ matrix.ray }}" + PYTEST_DAGSTER_VERSION: "${{ matrix.dagster }}" run: uv run pytest -v . lint: - name: lint ${{ matrix.py }} - ${{ matrix.os }} + name: Lint ${{ matrix.py }} runs-on: ${{ matrix.os }}-latest strategy: fail-fast: false diff --git a/Dockerfile b/Dockerfile index 8134f99..0009721 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ COPY --from=bitnami/kubectl:1.30.3 /opt/bitnami/kubectl/bin/kubectl /usr/local/b # install uv (https://github.com/astral-sh/uv) # docs for using uv with Docker: https://docs.astral.sh/uv/guides/integration/docker/ -COPY --from=ghcr.io/astral-sh/uv:0.4.18 /uv /bin/uv +COPY --from=ghcr.io/astral-sh/uv:0.4.25 /uv /bin/uv ENV UV_PROJECT_ENVIRONMENT=/usr/local/ ENV DAGSTER_HOME=/opt/dagster/dagster_home @@ -27,7 +27,7 @@ WORKDIR /src COPY pyproject.toml uv.lock ./ RUN --mount=type=cache,target=/root/.cache/uv \ - uv sync --frozen --all-extras --no-dev --no-install-project + uv sync --frozen --all-extras --no-dev --no-install-project --inexact FROM base-prod AS base-dev @@ -41,8 +41,18 @@ RUN --mount=type=cache,target=/cache/downloads \ curl https://nodejs.org/dist/v$NODE_VERSION/$NODE_PACKAGE.tar.gz -o /cache/downloads/$NODE_PACKAGE.tar.gz \ && tar -xzC /opt/ -f /cache/downloads/$NODE_PACKAGE.tar.gz + +RUN mkdir dagster_ray && touch dagster_ray/__init__.py && touch README.md +COPY dagster_ray/_version.py dagster_ray/_version.py + +# Install specific Dagster and Ray versions (for integration tests) +ARG RAY_VERSION=2.35.0 +ARG DAGSTER_VERSION=1.8.12 +RUN --mount=type=cache,target=/root/.cache/uv \ + uv add --no-sync "ray[all]==$RAY_VERSION" "dagster==$DAGSTER_VERSION" + RUN --mount=type=cache,target=/root/.cache/uv \ - uv sync --frozen --all-extras --no-install-project + uv sync --frozen --all-extras --no-install-project --inexact # ------------------------------------------------------------- FROM base-${BUILD_DEPENDENCIES} AS final @@ -51,4 +61,4 @@ FROM base-${BUILD_DEPENDENCIES} AS final COPY . . # finally install all our code -RUN uv sync --frozen --all-extras +RUN uv sync --frozen --all-extras --inexact diff --git a/tests/kuberay/conftest.py b/tests/kuberay/conftest.py index 9715de9..4077188 100644 --- a/tests/kuberay/conftest.py +++ b/tests/kuberay/conftest.py @@ -28,6 +28,9 @@ def kuberay_helm_repo(): @pytest.fixture(scope="session") def dagster_ray_image(): + import dagster + import ray + """ Either returns the image name from the environment variable PYTEST_DAGSTER_RAY_IMAGE or builds the image and returns it @@ -36,7 +39,11 @@ def dagster_ray_image(): if PYTEST_DAGSTER_RAY_IMAGE is None: # build the local image python_version = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}" - image = f"local/dagster-ray:py-{python_version}" + ray_version = os.getenv("PYTEST_RAY_VERSION") or ray.__version__ + dagster_version = os.getenv("PYTEST_DAGSTER_VERSION") or dagster.__version__ + + image = f"local/dagster-ray:py-{python_version}-{ray_version}-{dagster_version}" + subprocess.run( [ "docker", @@ -47,6 +54,10 @@ def dagster_ray_image(): "BUILD_DEPENDENCIES=dev", "--build-arg", f"PYTHON_VERSION={python_version}", + "--build-arg", + f"RAY_VERSION={ray_version}", + "--build-arg", + f"DAGSTER_VERSION={dagster_version}", "-t", image, str(ROOT_DIR), @@ -155,6 +166,8 @@ def k8s_with_raycluster( client.create( body={ + "Kind": "RayCluster", + "apiVersion": "ray.io/v1", "metadata": {"name": PERSISTENT_RAY_CLUSTER_NAME}, "spec": { "headGroupSpec": head_group_spec,