Skip to content

Commit

Permalink
ci: run unit-tests with composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
jszutenb committed Nov 18, 2024
1 parent 24220f8 commit 9e91710
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 36 deletions.
52 changes: 52 additions & 0 deletions .github/actions/unit-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "Unit tests"

inputs:
test-name:
description: 'Unit test name'
required: true

runs:
using: 'composite'
steps:
- name: Clean up disk space
run: |
df -h
sudo rm -rf \
/usr/lib/mono \
/usr/local/julia* \
/usr/local/lib/android \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
"$AGENT_TOOLSDIRECTORY"
df -h /
shell: bash
- name: Checkout code
uses: actions/checkout@v4
with:
path: repo
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install test prerequisites
run: sudo apt-get update && sudo apt-get -y install libgl1-mesa-glx
shell: bash
- name: Trigger unit tests
run: |
echo "Attempting to run unit tests"
cd repo/src
sudo tox -e {{ inputs.test-name }}
exit_code=$?
echo "Unit tests finished"
exit $exit_code
shell: bash
- name: Clean up virtualenv
run: |
sudo rm -rf .tox/{{ inputs.test-name }}
shell: bash
77 changes: 41 additions & 36 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,51 @@ on:
jobs:
unit-tests:
if: ${{ (github.event.repository.visibility == 'public') && (github.repository_owner == 'intel') }}
name: Run unit tests
name: Unit tests
runs-on: ubuntu-latest
defaults:
run:
shell: bash
permissions:
contents: read
steps:
- name: Clean up disk space
run: |
df -h
sudo rm -rf \
/usr/lib/mono \
/usr/local/julia* \
/usr/local/lib/android \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
"$AGENT_TOOLSDIRECTORY"
df -h /
- name: Checkout code
uses: actions/checkout@v4
with:
path: repo
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install test prerequisites
run: sudo apt-get update && sudo apt-get -y install libgl1-mesa-glx tox
- name: Trigger unit tests
run: |
echo "Attempting to run unit tests"
cd repo/src
tox -e embeddings_unit_tests,llms_unit_tests,dataprep_unit_tests,ingestion_unit_tests,prompt_registry_unit_tests,retrievers_unit_tests,reranks_unit_tests,vectorstores_unit_tests,llm_guard_input_guardrail_unit_tests,llm_guard_output_guardrail_unit_tests
exit_code=$?
echo "Unit tests finished"
exit $exit_code
- name: Ingestion unit tests
uses: ./.github/actions/unit-tests
with:
test-name: ingestion_unit_tests
- name: Prompt registry unit tests
uses: ./.github/actions/unit-tests
with:
test-name: prompt_registry_unit_tests
- name: Retrievers unit tests
uses: ./.github/actions/unit-tests
with:
test-name: retrievers_unit_tests
- name: Vectorstores unit tests
uses: ./.github/actions/unit-tests
with:
test-name: vectorstores_unit_tests
- name: Reranks unit tests
uses: ./.github/actions/unit-tests
with:
test-name: reranks_unit_tests
- name: Embeddings unit tests
uses: ./.github/actions/unit-tests
with:
test-name: embeddings_unit_tests
- name: Dataprep unit tests
uses: ./.github/actions/unit-tests
with:
test-name: dataprep_unit_tests
- name: LLMs unit tests
uses: ./.github/actions/unit-tests
with:
test-name: llms_unit_tests
- name: Guardrails input unit tests
uses: ./.github/actions/unit-tests
with:
test-name: llm_guard_input_guardrail_unit_tests
- name: Guardrails output unit tests
uses: ./.github/actions/unit-tests
with:
test-name: llm_guard_output_guardrail_unit_tests

0 comments on commit 9e91710

Please sign in to comment.