Skip to content

Integration Tests

Integration Tests #305

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Integration Tests
env:
ENVIRONMENT: INTEGRATION
on:
# weekday mealtimes
schedule:
- cron: '0 6,12,18 * * 1-5'
# or on-demand
workflow_dispatch:
# or on push to main
push:
branches:
- 'main'
permissions:
contents: read
jobs:
backend-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.COMMIT_HASH }}
path: integration
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.12"
- name: Set up Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.7.0
- name: Build Containers
run: |
cd integration
mkdir -p data/elastic/
chmod -R 777 data/
cp .env.integration .env
echo AZURE_OPENAI_ENDPOINT=${{ secrets.AZURE_OPENAI_ENDPOINT }} >> .env
echo AZURE_OPENAI_API_KEY=${{ secrets.AZURE_OPENAI_API_KEY }} >> .env
echo AZURE_OPENAI_MODEL=azure/gpt-4-turbo-2024-04-09 >> .env
docker compose up -d --wait core-api django-app
docker ps
- name: Test integration with pytest
run: |
cd integration
poetry install --only dev
poetry run playwright install --with-deps chromium
poetry run pytest tests/ --browser chromium
- name: notify slack failure
id: slack-failure
uses: slackapi/slack-github-action@v1.24.0
if: ${{ failure() && github.event_name == 'schedule' }}
with:
payload: |
{
"text": "Scheduled Integration Tests Failed",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Scheduled integration tests are failing :alert:"
}
},
{
"type": "divider"
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "logs"
},
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: notify slack pass
id: slack-pass
uses: slackapi/slack-github-action@v1.24.0
if: ${{ success() && github.event_name == 'schedule' }}
with:
payload: |
{
"text": "Scheduled Integration Tests Passed",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Scheduled integration tests are passing :white_check_mark:"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: Dump logs
if: failure()
uses: jwalton/gh-docker-logs@v2