diff --git a/.github/workflows/build-and-push-nightly.yml b/.github/workflows/build-and-push-nightly.yml index 4d8727836b..5974999fdb 100644 --- a/.github/workflows/build-and-push-nightly.yml +++ b/.github/workflows/build-and-push-nightly.yml @@ -1,4 +1,4 @@ -name: Build and Push to Vorvan - Nightly +name: Build Docker Image - Nightly on: schedule: diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 0000000000..67b32d2c94 --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,27 @@ +name: Build the Docker Image + +on: + push: + branches: [ main, docker_test ] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Clean Docker images + run: |- + echo "Available storage before cleaning:" + df -h + docker system prune --all --force + echo "Available storage:" + df -h + echo "Removing dotnet" + sudo rm -rf /usr/share/dotnet + echo "Available storage:" + df -h + - name: Docker Build Image + run: |- + docker build -t h2o-llmstudio . diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 24866fa5c7..ab5b53f594 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,6 +9,11 @@ jobs: test: runs-on: self-hosted steps: + # Pre-Action Cleanup + - name: Clean workspace pre action + run: | + rm -rf ${{ github.workspace }}/* + - uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v5 diff --git a/.github/workflows/test_nightly.yml b/.github/workflows/test_nightly.yml new file mode 100644 index 0000000000..a1c9e30d65 --- /dev/null +++ b/.github/workflows/test_nightly.yml @@ -0,0 +1,50 @@ +name: Test Docker Image - Nightly + +on: + push: + branches: [ main, docker_test ] + pull_request: + +jobs: + test-ui-nightly: + runs-on: [ self-hosted, gpu ] + steps: + # Pre-Action Cleanup + - name: Clean workspace pre action + run: | + rm -rf ${{ github.workspace }}/* + + - name: Run the Docker Image + run: |- + mkdir llmstudio_mnt + docker run --runtime=nvidia --shm-size=64g --init --name llmstudio --rm -d -u `id -u`:`id -g` -p 10101:10101 -v /var/run/docker.sock:/var/run/docker.sock:ro -v $(pwd)/llmstudio_mnt:/home/llmstudio/mount gcr.io/vorvan/h2oai/h2o-llmstudio:nightly + + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: 3.10.11 + - name: Run UI Tests + run: docker exec -it llmstudio bash "H2O_LLM_STUDIO_WORKDIR=/home/llmstudio/mount/ LOCAL_LOGIN=True PYTEST_BASE_URL=localhost:10101 make test-ui" + + - name: Stop the Docker Image + if: ${{ always() }} + run: |- + docker stop $(docker ps -q --filter ancestor=gcr.io/vorvan/h2oai/h2o-llmstudio:nightly) + - name: Remove the Docker Image + if: ${{ always() }} + run: |- + docker rmi gcr.io/vorvan/h2oai/h2o-llmstudio:nightly + - name: Clean up dangling images + if: ${{ always() }} + run: |- + docker image prune --force + docker volume prune --force + docker network prune --force + docker container prune --force + + # Post-Action Cleanup + - name: Clean workspace after action + if: ${{ always() }} + run: | + rm -rf ${{ github.workspace }}/* diff --git a/.github/workflows/test_ui.yml b/.github/workflows/test_ui.yml index fe7c778438..5bab187d09 100644 --- a/.github/workflows/test_ui.yml +++ b/.github/workflows/test_ui.yml @@ -9,6 +9,11 @@ jobs: test-ui: runs-on: self-hosted steps: + # Pre-Action Cleanup + - name: Clean workspace pre action + run: | + rm -rf ${{ github.workspace }}/* + - uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v5 diff --git a/README.md b/README.md index fdc10ca79e..3b92e198fa 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,9 @@ homelogs +[![Build Docker Image - Nightly](https://github.com/h2oai/h2o-llmstudio/actions/workflows/build-and-push-nightly.yml/badge.svg)](https://github.com/h2oai/h2o-llmstudio/actions/workflows/build-and-push-nightly.yml) +[![Test Docker Image - Nightly](https://github.com/h2oai/h2o-llmstudio/actions/workflows/test_nightly.yml/badge.svg)](https://github.com/h2oai/h2o-llmstudio/actions/workflows/test_nightly.yml) + ## Jump to - [With H2O LLM Studio, you can](#with-h2o-llm-studio-you-can) diff --git a/tests/ui/llm_studio_page.py b/tests/ui/llm_studio_page.py index 0a2c445744..51a1b221c5 100644 --- a/tests/ui/llm_studio_page.py +++ b/tests/ui/llm_studio_page.py @@ -64,10 +64,11 @@ def dataset_name(self, filename): def import_dataset_from_filesystem(self, filepath: str): self.import_dataset("Local") - if "LOCAL_LOGIN" in os.environ: - path = f"{LOCAL_FILESYSTEM_PATH}/{filepath}" + if "H2O_LLM_STUDIO_WORKDIR" in os.environ: + path = os.path.join(os.getenv("H2O_LLM_STUDIO_WORKDIR"), "data/user/oasst") else: - path = f"{CLOUD_FILESYSTEM_PATH}/{filepath}" + path = os.path.join(os.getcwd(), "data/user/oasst") + path = os.path.join(path, filepath) self.get_by_test_id(self.FILESYSTEM_SELECTOR).fill(path) self.continue_button().click()