Skip to content

[Test Framework] Add test scripts for getting started and setup #2

[Test Framework] Add test scripts for getting started and setup

[Test Framework] Add test scripts for getting started and setup #2

Workflow file for this run

name: Tests

Check failure on line 1 in .github/workflows/workflow_tests.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/workflow_tests.yml

Invalid workflow file

`setup-test` is not a valid event name
on:
workflow_call:
inputs:
ci_type:
type: string
default: 'pr'
setup-test:
name: setup-test
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{matrix.python-version}}
architecture: 'x64'
- name: Display Python version
run: |
python -c "import sys; print(sys.version)"
- name: Install dependencies for tests
run: |
python -m pip install --upgrade pip
pip install .[cpu] --extra-index-url https://download.pytorch.org/whl/cpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/cpu/us/
# Dynamic link oneCCL and Intel MPI libraries
source $(python -c "import oneccl_bindings_for_pytorch as torch_ccl; print(torch_ccl.cwd)")/env/setvars.sh
# Additional libraries required for pytest
pip install -r ./tests/requirements.txt
- name: Start Ray Cluster
run: |
ray start --head
- name: Run Test for Getting Started
run: |
./tests/test_getting_started.sh
- name: Run Test for Setup
run: |
./tests/test_setup.sh CPU
jobs:
bare-test:
name: bare-test
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{matrix.python-version}}
architecture: 'x64'
- name: Display Python version
run: |
python -c "import sys; print(sys.version)"
- name: Install dependencies for tests
run: |
python -m pip install --upgrade pip
pip install .[cpu] --extra-index-url https://download.pytorch.org/whl/cpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/cpu/us/
# Dynamic link oneCCL and Intel MPI libraries
source $(python -c "import oneccl_bindings_for_pytorch as torch_ccl; print(torch_ccl.cwd)")/env/setvars.sh
# Additional libraries required for pytest
pip install -r ./tests/requirements.txt
- name: Start Ray Cluster
run: |
ray start --head
- name: Run Tests
run: |
./tests/run-tests.sh
docker-test:
name: docker-test
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine Target
id: "target"
run: |
target="inference"
echo "target is ${target}"
echo "target=$target" >> $GITHUB_OUTPUT
- name: Build Docker Image
run: |
DF_SUFFIX=".tests_cpu_and_deepspeed"
TARGET=${{steps.target.outputs.target}}
docker build ./ --build-arg CACHEBUST=1 --build-arg python_v=${{matrix.python-version}} -f dev/docker/Dockerfile${DF_SUFFIX} -t ${TARGET}:latest && yes | docker container prune && yes
docker image prune -f
- name: Start Docker Container
run: |
TARGET=${{steps.target.outputs.target}}
cid=$(docker ps -q --filter "name=${TARGET}")
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid; fi
# check and remove exited container
cid=$(docker ps -a -q --filter "name=${TARGET}")
if [[ ! -z "$cid" ]]; then docker rm $cid; fi
docker ps -a
docker run -tid -v ${{ github.workspace }}:/root/llm-on-ray --name="${TARGET}" --hostname="${TARGET}-container" ${TARGET}:latest
- name: Install Dependencies for Tests
run: |
TARGET=${{steps.target.outputs.target}}
docker exec "${TARGET}" bash -c "pip install -r ./tests/requirements.txt"
- name: Start Ray Cluster
run: |
TARGET=${{steps.target.outputs.target}}
docker exec "${TARGET}" bash -c "./dev/scripts/start-ray-cluster.sh"
- name: Run Tests
run: |
TARGET=${{steps.target.outputs.target}}
docker exec "${TARGET}" bash -c "./tests/run-tests.sh"
- name: Stop Container
if: success() || failure()
run: |
TARGET=${{steps.target.outputs.target}}
cid=$(docker ps -q --filter "name=${TARGET}")
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid; fi