Skip to content

Commit

Permalink
CI
Browse files Browse the repository at this point in the history
  • Loading branch information
xsuler committed Feb 19, 2025
1 parent 1519624 commit 91a187f
Show file tree
Hide file tree
Showing 7 changed files with 629 additions and 40 deletions.
170 changes: 170 additions & 0 deletions .github/workflows/ray-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
name: Ray CI

on:
push:
pull_request:
workflow_dispatch:
inputs:
branch:
description: 'Branch to test'
required: false
default: 'main'
type: string

env:
PYTHON_VERSION: '3.11'
DOCKER_BUILDKIT: 1
RAY_CI_POST_WHEEL_TESTS: 1

jobs:
build-base-images:
name: Build Base Images
runs-on: self-hosted
strategy:
matrix:
python: ['3.11']
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Check Test Image Existence
id: check_test_image
run: |
if docker manifest inspect ghcr.io/${{ github.repository }}/oss-ci-base_test-py${{ matrix.python }} > /dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Build Base Test Image
if: steps.check_test_image.outputs.exists != 'true'
uses: docker/build-push-action@v3
with:
context: .
file: ci/docker/base.test.Dockerfile
tags: |
ghcr.io/${{ github.repository }}/oss-ci-base_test-py${{ matrix.python }}
push: true

- name: Check Build Image Existence
id: check_build_image
run: |
if docker manifest inspect ghcr.io/${{ github.repository }}/oss-ci-base_build-py${{ matrix.python }} > /dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Build OSS CI Base
if: steps.check_build_image.outputs.exists != 'true'
uses: docker/build-push-action@v3
with:
context: .
file: ci/docker/base.build.Dockerfile
tags: ghcr.io/${{ github.repository }}/oss-ci-base_build-py${{ matrix.python }}
build-args: |
DOCKER_IMAGE_BASE_TEST=ghcr.io/${{ github.repository }}/oss-ci-base_test-py${{ matrix.python }}
push: true

core-tests:
name: Core Tests
env:
BAZEL_DIR: ${{ github.workspace }}/../tmp/bazel/${{ github.sha }}
RAYCI_BUILD_ID: main
RAY_DIR: ${{ github.workspace }}
COMMIT_HASH: ${{ github.sha }}
needs: build-base-images
runs-on: self-hosted
strategy:
matrix:
python: ['3.11']
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Check Core Image Existence
id: check_core_image
run: |
if docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q "localhost:5000/citemp:${{ env.RAYCI_BUILD_ID }}-corebuild"; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Build core CI Base
if: steps.check_core_image.outputs.exists != 'true'
uses: docker/build-push-action@v3
with:
context: .
file: ci/docker/core.build.Dockerfile
tags: |
localhost:5000/citemp:${{ env.RAYCI_BUILD_ID }}-corebuild
build-args: |
RAYCI_IS_GPU_BUILD=false
DOCKER_IMAGE_BASE_BUILD=ghcr.io/${{ github.repository }}/oss-ci-base_build-py${{ matrix.python }}
push: true

- name: Run Core Python Tests
env:
RAYCI_WORK_REPO: localhost:5000/citemp

run: |
echo "Running core: python tests..."
bazel run //ci/ray_ci:test_in_docker -- //python/ray/tests/... core \
--workers 1 --worker-id 0 --parallelism-per-worker 8 \
--except-tags debug_tests,asan_tests,post_wheel_build,ha_integration,mem_pressure,tmpfs,container,manual,use_all_core,multi_gpu \
--test-env=BAZEL_DIR=$(realpath ${{ env.BAZEL_DIR }})
- name: Workaround
if: always()
run: |
echo "artifacts_path=$(realpath ${{ env.BAZEL_DIR }})" >> $GITHUB_ENV
- name: Generate Report
if: always()
run: |
python ci/ray_ci/report_gen.py
- name: Cleanup Containers
if: always()
run: |
docker ps -a --filter ancestor=localhost:5000/citemp:${{ env.RAYCI_BUILD_ID }}-corebuild -q | xargs -r docker rm --force
- name: Copy Report Files
if: always()
run: |
mkdir -p /data1/static/ci/${{ github.sha }}
cp -r ${{ env.BAZEL_DIR }}/reports/* /data1/static/ci/${{ github.sha }}/
- name: Get Public IP
if: always()
run: |
echo "RUNNER_PUBLIC_IP=$(curl -s https://api.ipify.org)" >> $GITHUB_ENV
- name: Show Report Location
if: always()
run: |
echo "Report files are available at: http://${{ env.RUNNER_PUBLIC_IP }}:8000/${{ github.sha }}/index.html"
2 changes: 1 addition & 1 deletion build-docker-ant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ docker run --rm \
antgroup/base-deps:dev$GPU \
pip download --no-cache-dir --quiet --no-deps --only-binary=:all: "$ANT_RAY_PACKAGE" -d /wheels

WHEEL_FILE=$(ls "$RAY_BUILD_DIR"/.whl/*.whl 2>/dev/null | head -n1)
WHEEL_FILE=$(find "$RAY_BUILD_DIR/.whl" -name '*.whl' -type f -print -quit 2>/dev/null)
if [[ -z "$WHEEL_FILE" ]]; then
echo "Error: No wheel downloaded for ant-ray" >&2
exit 1
Expand Down
12 changes: 9 additions & 3 deletions ci/ray_ci/linux_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def install_ray(self, build_type: Optional[str] = None) -> List[str]:
"-t",
self._get_docker_image(),
"-f",
"/ray/ci/ray_ci/tests.env.Dockerfile",
"/ray",
f"{os.environ.get('RAY_DIR')}/ci/ray_ci/tests.env.Dockerfile",
os.environ.get("RAY_DIR"),
],
env=env,
stdout=sys.stdout,
Expand Down Expand Up @@ -84,4 +84,10 @@ def get_run_command_extra_args(
return extra_args

def get_artifact_mount(self) -> Tuple[str, str]:
return ("/tmp/artifacts", "/artifact-mount")
os.makedirs(
os.path.join(os.environ.get("BAZEL_DIR"), "artifacts"), exist_ok=True
)
return (
os.path.join(os.environ.get("BAZEL_DIR"), "artifacts"),
os.environ.get("BAZEL_DIR"),
)
Loading

0 comments on commit 91a187f

Please sign in to comment.