Commit 80b84321 authored by baberabb's avatar baberabb
Browse files

add CI test case if api/* files changed then pytest more tasks

parent 8e3f1a49
...@@ -27,22 +27,24 @@ jobs: ...@@ -27,22 +27,24 @@ jobs:
files_yaml: | files_yaml: |
tasks: tasks:
- lm_eval/tasks/** - lm_eval/tasks/**
api:
- lm_eval/api/**
write_output_files: true write_output_files: true
- name: Run Tests - name: Run Tests
if: steps.changed-tasks.outputs.tasks_any_modified == 'true' if: steps.changed-tasks.outputs.tasks_any_modified == 'true' || steps.changed-tasks.outputs.api_any_modified == 'true'
run: | run: |
echo .github/outputs/tasks_all_changed_and_modified_files.txt >> 'GITHUB_ENV' echo .github/outputs/tasks_all_changed_and_modified_files.txt >> 'GITHUB_ENV'
echo "One or more test file(s) has changed." echo "One or more test file(s) has changed."
echo "List of all the files that have changed: ${{ steps.changed-tasks.outputs.tasks_all_modified_files }}" echo "List of all the files that have changed: ${{ steps.changed-tasks.outputs.tasks_all_modified_files }}"
- name: Set up Python 3.9 - name: Set up Python 3.9
if: steps.changed-tasks.outputs.tasks_any_modified == 'true' if: steps.changed-tasks.outputs.tasks_any_modified == 'true' || steps.changed-tasks.outputs.api_any_modified == 'true'
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: 3.9 python-version: 3.9
cache: 'pip' cache: 'pip'
- name: Install dependencies - name: Install dependencies
if: steps.changed-tasks.outputs.tasks_any_modified == 'true' if: steps.changed-tasks.outputs.tasks_any_modified == 'true' || steps.changed-tasks.outputs.api_any_modified == 'true'
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -e '.[testing]' --extra-index-url https://download.pytorch.org/whl/cpu pip install -e '.[testing]' --extra-index-url https://download.pytorch.org/whl/cpu
...@@ -52,3 +54,8 @@ jobs: ...@@ -52,3 +54,8 @@ jobs:
- name: Test with pytest - name: Test with pytest
if: steps.changed-tasks.outputs.tasks_any_modified == 'true' if: steps.changed-tasks.outputs.tasks_any_modified == 'true'
run: python -m pytest tests/test_tasks.py -s -vv -n=auto --new_task run: python -m pytest tests/test_tasks.py -s -vv -n=auto --new_task
- name: Test more tasks with pytest
env:
API: true
if: steps.changed-tasks.outputs.api_any_modified == 'true'
run: python -m pytest tests/test_api.py -s -vv -n=auto --new_task
...@@ -14,11 +14,12 @@ def any_new_tasks(request) -> bool: ...@@ -14,11 +14,12 @@ def any_new_tasks(request) -> bool:
# ["arc_easy] else get list of new tasks # ["arc_easy] else get list of new tasks
def new_tasks(any_new_tasks: bool) -> List[str]: def new_tasks(any_new_tasks: bool) -> List[str]:
FILENAME = ".github/outputs/tasks_all_changed_and_modified_files.txt" FILENAME = ".github/outputs/tasks_all_changed_and_modified_files.txt"
return [ if any_new_tasks and os.path.exists(FILENAME):
parser(load_changed_files(FILENAME)) return [parser(load_changed_files(FILENAME))]
if any_new_tasks and os.path.exists(FILENAME) elif "API" in os.getenv():
else "arc_easy" return ["arc_easy", "hellaswag", "piqa", "wikitext"]
] else:
return ["arc_easy"]
@pytest.fixture(params=new_tasks(any_new_tasks)) @pytest.fixture(params=new_tasks(any_new_tasks))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment