Skip to content

Commit d631de9

Browse files
authored
Merge v1.0 into main (#1621)
2 parents 73f2ba9 + 2aeed06 commit d631de9

File tree

300 files changed

+21850
-12037
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

300 files changed

+21850
-12037
lines changed

.github/workflows/tests.yml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Tests
22

33
on:
44
pull_request:
5-
branches: [main]
5+
branches: [main,v1.0]
66
push:
77
branches: [main]
88

@@ -29,6 +29,11 @@ jobs:
2929
uses: actions/setup-python@v4
3030
with:
3131
python-version: ${{ matrix.python-version }}
32+
- name: Install Ollama
33+
run: |
34+
curl -fsSL https://ollama.com/install.sh | sh
35+
ollama --version
36+
ollama pull tinyllama
3237
- name: Set up test environment
3338
run: |
3439
python -m pip install --upgrade pip
@@ -46,7 +51,7 @@ jobs:
4651
echo "::set-output name=id::$MATRIX_ID"
4752
- name: Run tests
4853
run: |
49-
uv run pytest -x --cov=outlines
54+
uv run pytest -x --cov=outlines -m 'not api_call'
5055
env:
5156
COVERAGE_FILE: .coverage.${{ steps.matrix-id.outputs.id }}
5257
- name: Upload coverage data
@@ -82,16 +87,30 @@ jobs:
8287
with:
8388
name: coverage-data
8489

85-
- name: Fetch main for coverage diff
90+
- name: Determine base branch for comparison
91+
id: base-branch
92+
run: |
93+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
94+
# For PRs, use the remote tracking branch
95+
COMPARE_BRANCH="origin/${{ github.base_ref }}"
96+
echo "COMPARE_BRANCH=$COMPARE_BRANCH" >> $GITHUB_ENV
97+
else
98+
# For push events, compare against the parent commit
99+
COMPARE_BRANCH="${{ github.event.before }}"
100+
echo "COMPARE_BRANCH=$COMPARE_BRANCH" >> $GITHUB_ENV
101+
fi
102+
echo "Using $COMPARE_BRANCH for coverage comparison"
103+
104+
- name: Fetch base branch for coverage diff
86105
run: |
87-
git fetch --no-tags --prune origin main
106+
git fetch --no-tags --prune origin ${COMPARE_BRANCH#origin/}
88107
89108
- name: Combine coverage & fail if it's <100%.
90109
run: |
91110
python -m coverage combine
92111
python -m coverage html --skip-covered --skip-empty
93112
python -m coverage xml
94-
diff-cover coverage.xml --markdown-report=coverage.md --fail-under=100 || (cat coverage.md >> $GITHUB_STEP_SUMMARY && exit 1)
113+
diff-cover coverage.xml --compare-branch=$COMPARE_BRANCH --markdown-report=coverage.md --fail-under=100 || (cat coverage.md >> $GITHUB_STEP_SUMMARY && exit 1)
95114
96115
- name: Upload HTML report if check failed.
97116
uses: actions/upload-artifact@v4

.github/workflows/tests_nightly.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Nightly Tests
2+
3+
# Run every day at 6:00 AM UTC
4+
on:
5+
schedule:
6+
- cron: "0 6 * * *"
7+
8+
jobs:
9+
tests:
10+
name: Run the tests
11+
runs-on: ubuntu-latest
12+
env:
13+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
14+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
15+
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
16+
DOTTXT_API_KEY: ${{ secrets.DOTTXT_API_KEY }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
python-version: ["3.10"]
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
- name: Install Ollama
29+
run: |
30+
curl -fsSL https://ollama.com/install.sh | sh
31+
ollama --version
32+
ollama pull tinyllama
33+
- name: Set up test environment
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install uv
37+
uv venv
38+
uv pip install -e .[test]
39+
- name: Create matrix id
40+
id: matrix-id
41+
env:
42+
MATRIX_CONTEXT: ${{ toJson(matrix) }}
43+
run: |
44+
echo $MATRIX_CONTEXT
45+
export MATRIX_ID=`echo $MATRIX_CONTEXT | md5sum | cut -c 1-32`
46+
echo $MATRIX_ID
47+
echo "::set-output name=id::$MATRIX_ID"
48+
- name: Run tests
49+
run: |
50+
uv run pytest -x --cov=outlines
51+
env:
52+
COVERAGE_FILE: .coverage.${{ steps.matrix-id.outputs.id }}
53+
- name: Slack notification on failure
54+
if: failure()
55+
uses: 8398a7/action-slack@v3
56+
with:
57+
status: ${{ job.status }}
58+
fields: commit,author,ref
59+
env:
60+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_TESTS_ERRORS_WEBHOOK_URL }}

Dockerfile

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)