Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/integration-test-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Trigger Integration Tests

on:
issue_comment:
types:
- created

jobs:
trigger:
if: |
github.event.issue.pull_request &&
startsWith(github.event.comment.body, '/integration-test') &&
(
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'OWNER'
)

runs-on: ubuntu-latest

permissions:
actions: write
contents: read
pull-requests: read

steps:
- name: Get PR details
id: pr
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});

core.setOutput('head_sha', pr.data.head.sha);
core.setOutput('head_ref', pr.data.head.ref);
core.setOutput('head_repo', pr.data.head.repo.full_name);

- name: Dispatch integration workflow
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'integration-tests.yml',
ref: 'main',
inputs: {
sha: '${{ steps.pr.outputs.head_sha }}',
ref: '${{ steps.pr.outputs.head_ref }}',
repository: '${{ steps.pr.outputs.head_repo }}'
}
});
71 changes: 42 additions & 29 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,59 +6,57 @@ on:
- main

workflow_dispatch:
inputs:
sha:
required: false
type: string

issue_comment:
types:
- created
ref:
required: false
type: string

repository:
required: false
type: string

jobs:
integration:
name: Live LLM Integration Tests

if: |
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
(
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
startsWith(github.event.comment.body, '/integration-test') &&
(
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'OWNER'
)
)

runs-on: ubuntu-latest

permissions:
statuses: write
contents: read

defaults:
run:
working-directory: ./backend

steps:
- name: Get PR details
if: github.event_name == 'issue_comment'
id: pr
- name: Set pending status
if: inputs.sha != ''
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const pr = await github.rest.pulls.get({
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
sha: '${{ inputs.sha }}',
state: 'pending',
context: 'Live LLM Integration Tests',
target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
});

core.setOutput('head_ref', pr.data.head.ref);
core.setOutput('head_repo', pr.data.head.repo.full_name);

- name: Checkout PR branch
if: github.event_name == 'issue_comment'
- name: Checkout PR commit
if: inputs.sha != ''
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 #v4.3.1
with:
repository: ${{ steps.pr.outputs.head_repo }}
ref: ${{ steps.pr.outputs.head_ref }}
repository: ${{ inputs.repository }}
ref: ${{ inputs.sha }}

- name: Checkout repository
if: github.event_name != 'issue_comment'
if: inputs.sha == ''
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 #v4.3.1

- name: Set up Python
Expand All @@ -72,7 +70,22 @@ jobs:
pip install -e .

- name: Run integration tests
id: tests
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: make test-integration

- name: Set final status
if: always() && inputs.sha != ''
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: '${{ inputs.sha }}',
state: '${{ steps.tests.outcome }}' === 'success' ? 'success' : 'failure',
context: 'Live LLM Integration Tests',
target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
});
2 changes: 1 addition & 1 deletion backend/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def root(*args):
},
"root": {
"handlers": ["console"],
"level": "DEBUG",
"level": "INFO",
},
}

Expand Down
Loading