Compare commits

...

9 Commits

Author SHA1 Message Date
hagen-danswer
d304e3fd0f gotem 2024-09-11 11:41:40 -07:00
hagen-danswer
475e528697 perhaps now this will work 2024-09-11 11:39:26 -07:00
hagen-danswer
2392751051 wb this? 2024-09-11 11:37:21 -07:00
hagen-danswer
82b5934597 trya again 2024-09-11 11:35:55 -07:00
hagen-danswer
bfe695dd1e refactor 2024-09-11 11:28:03 -07:00
hagen-danswer
9090391275 fixed no cap 2024-09-11 11:22:50 -07:00
hagen-danswer
6e85807640 fixed fr 2024-09-11 11:21:20 -07:00
hagen-danswer
183bdcaf5d fixed 2024-09-11 11:18:21 -07:00
hagen-danswer
b228675b1b Made PR checks only run when relevant files are changed 2024-09-11 11:07:56 -07:00
5 changed files with 72 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
name: Check Backend Changes
on:
workflow_call:
outputs:
run-tests:
description: "Whether to run tests based on backend changes"
value: ${{ jobs.check-run-needed.outputs.run-tests }}
jobs:
check-run-needed:
runs-on: ubuntu-latest
outputs:
run-tests: ${{ steps.check.outputs.run-tests }}
steps:
- uses: actions/checkout@v4
- id: check
run: |
if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q '^backend/'; then
echo "run-tests=true" >> $GITHUB_OUTPUT
else
echo "run-tests=false" >> $GITHUB_OUTPUT
fi

View File

@@ -6,7 +6,12 @@ on:
branches: [ main ]
jobs:
check-changes:
uses: ./.github/workflows/check-backend-changes.yml
mypy-check:
needs: check-changes
if: needs.check-changes.outputs.run-tests == 'true'
runs-on: ubuntu-latest
steps:
@@ -47,3 +52,10 @@ jobs:
run: |
cd backend
black --check .
skip-tests:
needs: check-changes
if: needs.check-changes.outputs.run-tests == 'false'
runs-on: ubuntu-latest
steps:
- run: echo "No changes in backend, skipping this test."

View File

@@ -17,7 +17,12 @@ env:
CONFLUENCE_ACCESS_TOKEN: ${{ secrets.CONFLUENCE_ACCESS_TOKEN }}
jobs:
check-changes:
uses: ./.github/workflows/check-backend-changes.yml
connectors-check:
needs: check-changes
if: needs.check-changes.outputs.run-tests == 'true'
runs-on: ubuntu-latest
env:
@@ -55,3 +60,10 @@ jobs:
-H 'Content-type: application/json' \
--data '{"text":"Scheduled Connector Tests failed! Check the run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' \
$SLACK_WEBHOOK
skip-tests:
needs: check-changes
if: needs.check-changes.outputs.run-tests == 'false'
runs-on: ubuntu-latest
steps:
- run: echo "No changes in backend, skipping this test."

View File

@@ -6,7 +6,12 @@ on:
branches: [ main ]
jobs:
check-changes:
uses: ./.github/workflows/check-backend-changes.yml
backend-check:
needs: check-changes
if: needs.check-changes.outputs.run-tests == 'true'
runs-on: ubuntu-latest
env:
@@ -34,3 +39,11 @@ jobs:
- name: Run Tests
shell: script -q -e -c "bash --noprofile --norc -eo pipefail {0}"
run: py.test -o junit_family=xunit2 -xv --ff backend/tests/unit
skip-tests:
needs: check-changes
if: needs.check-changes.outputs.run-tests == 'false'
runs-on: ubuntu-latest
steps:
- run: echo "No changes in backend, skipping this test."

View File

@@ -12,7 +12,12 @@ env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
jobs:
check-changes:
uses: ./.github/workflows/check-backend-changes.yml
integration-tests:
needs: check-changes
if: needs.check-changes.outputs.run-tests == 'true'
runs-on:
group: 'arm64-image-builders'
steps:
@@ -158,3 +163,10 @@ jobs:
run: |
cd deployment/docker_compose
docker compose -f docker-compose.dev.yml -p danswer-stack down -v
skip-tests:
needs: check-changes
if: needs.check-changes.outputs.run-tests == 'false'
runs-on: ubuntu-latest
steps:
- run: echo "No changes in backend, skipping this test."