test: Separate test and build workflows #72
Workflow file for this run
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: "Test" | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- "**.md" | |
- "proto/**" | |
defaults: | |
run: | |
shell: bash | |
env: | |
CI: true | |
DOCKER_BUILDKIT: 1 | |
TEST_IMAGE_NAME: "cpu-tests:0" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: "Free up disk space" | |
uses: ./.github/actions/free-up-disk-space | |
- name: "Set up QEMU" | |
uses: docker/setup-qemu-action@v3 | |
- name: "Setup Docker Buildx" | |
uses: docker/setup-buildx-action@v3 | |
- name: "Build test image" | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
target: "cpu-tests" | |
tags: ${{ env.TEST_IMAGE_NAME }} | |
outputs: type=docker,dest=/tmp/test_image.tar | |
- name: "Upload test image" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "test-image" | |
path: /tmp/test_image.tar | |
retention-days: 1 | |
test-python: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v3 | |
- name: "Free up disk space" | |
uses: ./.github/actions/free-up-disk-space | |
- name: "Setup Docker Buildx" | |
uses: docker/setup-buildx-action@v3 | |
- name: "Download test image" | |
uses: actions/download-artifact@v3 | |
with: | |
name: "test-image" | |
path: /tmp | |
- name: "Load Docker image" | |
run: | | |
docker load --input /tmp/test_image.tar | |
docker image ls -a | |
- name: "Run Python tests" | |
run: | | |
#make python-tests | |
docker run --rm \ | |
-v /tmp/transformers_cache:/transformers_cache \ | |
-e HUGGINGFACE_HUB_CACHE=/transformers_cache \ | |
-e TRANSFORMERS_CACHE=/transformers_cache \ | |
$TEST_IMAGE_NAME pytest -sv \ | |
--ignore=server/tests/test_utils.py \ | |
--ignore=server/tests/models/test_bloom.py \ | |
--ignore=server/tests/models/test_causal_lm.py \ | |
--ignore=server/tests/models/test_seq2seq_lm.py \ | |
--ignore=server/tests/utils/test_convert.py \ | |
-k "not cache_with_eviction and not tensor_too_large" \ | |
server/tests | |
integration-tests: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v3 | |
- name: "Free up disk space" | |
uses: ./.github/actions/free-up-disk-space | |
- name: "Setup Docker Buildx" | |
uses: docker/setup-buildx-action@v3 | |
- name: "Download test image" | |
uses: actions/download-artifact@v3 | |
with: | |
name: "test-image" | |
path: /tmp | |
- name: "Load Docker image" | |
run: | | |
docker load --input /tmp/test_image.tar | |
docker image ls -a | |
- name: "Run integration tests" | |
run: make integration-tests |