forked from i-dot-ai/redbox
-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (125 loc) · 3.86 KB
/
integration.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# 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