Skip to content

Commit ad67c70

Browse files
committed
ci: add a Github Actions workflow for smoke test
1 parent 62676a1 commit ad67c70

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

.github/workflows/test.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ${{ matrix.os }}
8+
if: "!contains(github.event.head_commit.message, 'ci skip')"
9+
strategy:
10+
matrix:
11+
os: [macos-latest, windows-latest, ubuntu-latest]
12+
steps:
13+
- name: Cancel previous run
14+
uses: styfle/[email protected]
15+
with:
16+
access_token: ${{ github.token }}
17+
- uses: actions/checkout@v3
18+
- name: Set up Python 3.9
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: 3.9
22+
- name: Upgrade pip
23+
run: |
24+
python -m pip install --upgrade pip setuptools wheel
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install -r requirements.txt
28+
- name: Test
29+
env:
30+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
31+
OPENAI_ORGANIZATION: ${{ secrets.OPENAI_ORGANIZATION }}
32+
run: |
33+
python benchmark.py --task tasksolving/mgsm/gpt-3.5 --dataset_path data/mgsm/test_sample.jsonl --overwrite --output_path ci_smoke_test_output
34+
python evaluate_math.py --path ci_smoke_test_output/results.jsonl --ci_smoke_test

data/mgsm/test_sample.jsonl

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"question": "Sophia is thinking of taking a road trip in her car, and would like to know how far she can drive on a single tank of gas. She has traveled 100 miles since last filling her tank, and she needed to put in 4 gallons of gas to fill it up again. The owner's manual for her car says that her tank holds 12 gallons of gas. How many miles can Sophia drive on a single tank of gas?", "answer": null, "answer_number": 300, "equation_solution": null}

evaluate_math.py

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
parser = ArgumentParser()
88
parser.add_argument("--path", type=str, required=True)
99
parser.add_argument("--max_line", type=int, default=1000000000000)
10+
parser.add_argument("--ci_smoke_test", action="store_true")
1011
args = parser.parse_args()
1112

1213

@@ -88,3 +89,5 @@ def check_corr(result: str, correct_solution: str, tol: float = 1e-3):
8889
err_cnts.append(err_cnt)
8990
print(final_accs)
9091
print(err_cnts)
92+
if args.ci_smoke_test is True:
93+
assert final_accs[0] == 1.0

requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ typing-extensions==4.5.0
1515
typing-inspect==0.8.0
1616
colorlog
1717
rapidfuzz
18-
spacy
18+
spacy
19+
colorama==0.4.6

0 commit comments

Comments
 (0)