Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
lm-evaluation-harness
Commits
80b84321
Commit
80b84321
authored
Jul 17, 2023
by
baberabb
Browse files
add CI test case if api/* files changed then pytest more tasks
parent
8e3f1a49
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
.github/workflows/new_tasks.yml
.github/workflows/new_tasks.yml
+10
-3
tests/test_tasks.py
tests/test_tasks.py
+6
-5
No files found.
.github/workflows/new_tasks.yml
View file @
80b84321
...
@@ -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
tests/test_tasks.py
View file @
80b84321
...
@@ -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
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment