Add ci #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: ubuntu-latest | |
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 | |
# - name: Check ML Image Existence | |
# id: check_ml_image | |
# run: | | |
# if docker manifest inspect ghcr.io/${{ github.repository }}/oss-ci-base_ml-py${{ matrix.python }} > /dev/null 2>&1; then | |
# echo "exists=true" >> $GITHUB_OUTPUT | |
# else | |
# echo "exists=false" >> $GITHUB_OUTPUT | |
# fi | |
# | |
# - name: Build ML Base | |
# if: steps.check_ml_image.outputs.exists != 'true' | |
# uses: docker/build-push-action@v3 | |
# with: | |
# context: . | |
# file: ci/docker/base.ml.Dockerfile | |
# tags: ghcr.io/${{ github.repository }}/oss-ci-base_ml-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 | |
needs: build-base-images | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: ['3.11'] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.branch || github.ref }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Build Core Image | |
run: | | |
docker build -t ray-ci-core \ | |
--build-arg BASE_IMAGE=ghcr.io/${{ github.repository }}/oss-ci-base_build-py${{ matrix.python }} \ | |
-f ci/docker/core.build.Dockerfile . | |
- name: Run Core Tests | |
run: | | |
docker run --rm -v $(pwd):/ray ray-ci-core \ | |
bazel test --config=ci //python/ray/tests/... //python/ray/dag/... \ | |
--test_env=PYTHON_VERSION=${{ matrix.python }} \ | |
--build_tests_only \ | |
--test_output=streamed | |
- name: Upload Test Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: core-test-results-${{ matrix.python }} | |
path: | | |
test-results.xml | |
/tmp/artifacts/**/* | |
# data-tests: | |
# name: Data Tests | |
# needs: build-base-images | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v4 | |
# with: | |
# ref: ${{ github.event.inputs.branch || github.ref }} | |
# | |
# - name: Build Data Image | |
# run: | | |
# docker build -t ray-ci-data \ | |
# --build-arg BASE_IMAGE=rayproject/oss-ci-base_ml-py3.11 \ | |
# -f ci/docker/data.build.Dockerfile . | |
# | |
# - name: Run Data Tests | |
# run: | | |
# docker run --rm -v $(pwd):/ray ray-ci-data \ | |
# bazel test --config=ci //python/ray/data/... \ | |
# --test_env=PYTHON_VERSION=3.11 \ | |
# --test_output=streamed | |
# | |
- name: Upload Test Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: data-test-results | |
path: | | |
test-results.xml | |
/tmp/artifacts/**/* | |
report: | |
name: Generate Report | |
needs: [core-tests] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download all test results | |
uses: actions/download-artifact@v4 | |
- name: Test Summary | |
uses: test-summary/action@v2 | |
with: | |
paths: '**/test-results.xml' | |
name: Test Results Summary | |
show_passed: false |