mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
Signed-off-by: Saurabh Misra <misra.saurabh1@gmail.com> Co-authored-by: saga4 <saga4@codeflashs-MacBook-Air.local> Co-authored-by: Sarthak Agarwal <sarthak.saga@gmail.com> Co-authored-by: Mohamed Ashraf <mohamedashrraf222@gmail.com> Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
72 lines
1.8 KiB
YAML
72 lines
1.8 KiB
YAML
name: django-unit-tests
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
paths:
|
|
- "django/aiservice/**"
|
|
workflow_dispatch:
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: ./django/aiservice
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
jobs:
|
|
# This job checks if the workflow should run based on file changes
|
|
check-changes:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
should-run: ${{ steps.filter.outputs.aiservice }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: dorny/paths-filter@v3
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
aiservice:
|
|
- 'django/aiservice/**'
|
|
|
|
# This job always runs and succeeds, allowing PRs to be merged when paths don't match
|
|
skip-unit-tests:
|
|
needs: check-changes
|
|
if: needs.check-changes.outputs.should-run != 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Skip tests
|
|
run: echo "Skipping django unit tests - no changes in django/aiservice/"
|
|
|
|
unit-tests:
|
|
needs: check-changes
|
|
if: needs.check-changes.outputs.should-run == 'true'
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
SECRET_KEY: ${{ secrets.SECRET_KEY }}
|
|
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
|
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
|
|
OPENAI_API_TYPE: ${{ secrets.OPENAI_API_TYPE }}
|
|
OPENAI_API_BASE: ${{ secrets.OPENAI_API_BASE }}
|
|
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v7
|
|
with:
|
|
python-version: "3.12"
|
|
- name: Install project dependencies
|
|
run: uv sync
|
|
|
|
- name: Django Unit tests
|
|
run: uv run pytest
|