-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
3247cd8
commit cb84bd6
Showing
2 changed files
with
79 additions
and
44 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
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,70 @@ | ||
name: Build and Test | ||
|
||
on: | ||
push: | ||
branches: ["main", "development"] | ||
pull_request: | ||
branches: ["main", "development"] | ||
workflow_dispatch: # Allow manual triggering | ||
|
||
jobs: | ||
test: | ||
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false # Don't cancel other jobs if one fails | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
python-version: ["3.10", "3.12"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Fetch all history for proper versioning | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' # Cache pip dependencies | ||
|
||
- name: Install poetry | ||
shell: bash | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install poetry | ||
- name: Configure poetry | ||
shell: bash | ||
run: | | ||
poetry config virtualenvs.create true | ||
poetry config virtualenvs.in-project true | ||
- name: Cache poetry dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ./.venv | ||
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: | | ||
poetry install --no-interaction --all-extras | ||
- name: Run tests | ||
shell: bash | ||
run: | | ||
poetry run pytest tests/ -v --color=yes | ||
env: | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
PYTHONUNBUFFERED: "1" # For real-time test output | ||
|
||
- name: Upload test results | ||
if: always() # Run even if tests fail | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: test-results-${{ matrix.os }}-${{ matrix.python-version }} | ||
path: | | ||
.pytest_cache | ||
pytest-report.xml | ||
if-no-files-found: ignore |