-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22175cb
commit f32ee09
Showing
7 changed files
with
127 additions
and
23 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Run Examples | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 3 * * *' | ||
push: # to remove | ||
|
||
env: | ||
FORCE_COLOR: "1" | ||
|
||
jobs: | ||
run-examples: | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 60 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest-8-cores, macos-latest, windows-latest-8-cores] | ||
pyv: ['3.9', '3.12'] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.pyv }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.pyv }} | ||
cache: 'pip' | ||
|
||
- name: Upgrade nox and uv | ||
run: | | ||
python -m pip install --upgrade 'nox[uv]' | ||
nox --version | ||
uv --version | ||
- name: Run benchmarks | ||
run: nox -s examples |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import glob | ||
import os | ||
import subprocess | ||
import sys | ||
|
||
import pytest | ||
|
||
get_started_examples = glob.glob("examples/get_started/**/*.py", recursive=True) | ||
llm_and_nlp_examples = filter( | ||
# no anthropic token | ||
lambda filename: "claude" not in filename, | ||
glob.glob("examples/llm_and_nlp/**/*.py", recursive=True), | ||
) | ||
multimodal_examples = filter( | ||
# no OpenAI token and hf download painfully slow | ||
lambda filename: "openai" not in filename and "hf" not in filename, | ||
glob.glob("examples/multimodal/**/*.py", recursive=True), | ||
) | ||
|
||
|
||
def smoke_test(example: str): | ||
completed_process = subprocess.run( # noqa: S603 | ||
[sys.executable, example], | ||
capture_output=True, | ||
cwd=os.path.abspath(os.path.join(__file__, "..", "..", "..")), | ||
check=True, | ||
) | ||
|
||
assert completed_process.stdout | ||
assert completed_process.stderr | ||
|
||
|
||
@pytest.mark.examples | ||
@pytest.mark.parametrize("example", get_started_examples) | ||
def test_get_started_examples(example): | ||
smoke_test(example) | ||
|
||
|
||
@pytest.mark.examples | ||
@pytest.mark.parametrize("example", llm_and_nlp_examples) | ||
def test_llm_and_nlp_examples(example): | ||
smoke_test(example) | ||
|
||
|
||
@pytest.mark.examples | ||
@pytest.mark.parametrize("example", multimodal_examples) | ||
def test_multimodal(example): | ||
smoke_test(example) |