Skip to content

Commit 37461ca

Browse files
Refactor deploy and test automation workflow
Rename automation test folder
1 parent eda9402 commit 37461ca

26 files changed

Lines changed: 215 additions & 179 deletions

.github/workflows/deploy.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1-
name: Validate Deployment
1+
name: DocGen Deploy-Test-Cleanup Pipeline
22

33
on:
4-
push:
4+
workflow_run:
5+
workflows: [ Build Docker and Optional Push ]
56
branches:
7+
- main
8+
- dev
69
- deploy-and-test
10+
types:
11+
- completed
12+
# push:
13+
# branches:
14+
# - deploy-and-test
715
# - main
816
# schedule:
917
# - cron: '0 9,21 * * *' # Runs at 9:00 AM and 9:00 PM GMT
1018

1119
env:
1220
GPT_MIN_CAPACITY: 250
1321
TEXT_EMBEDDING_MIN_CAPACITY: 40
22+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
1423

1524
jobs:
1625
deploy:
@@ -118,6 +127,13 @@ jobs:
118127
id: deploy
119128
run: |
120129
set -e
130+
# get right image tag based on branch
131+
if [[ "${{ env.BRANCH_NAME }}" == "main" ]]; then
132+
IMAGE_TAG="latest"
133+
elif [[ "${{ env.BRANCH_NAME }}" == "dev" ]]; then
134+
IMAGE_TAG="dev"
135+
else
136+
IMAGE_TAG="latest"
121137
az deployment group create \
122138
--name ${{ env.SOLUTION_PREFIX }}-deployment \
123139
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
@@ -131,7 +147,7 @@ jobs:
131147
gptDeploymentCapacity=${{ env.GPT_MIN_CAPACITY }} \
132148
embeddingModel="text-embedding-ada-002" \
133149
embeddingDeploymentCapacity=${{ env.TEXT_EMBEDDING_MIN_CAPACITY }} \
134-
imageTag="latest"
150+
imageTag="${IMAGE_TAG}"
135151
136152
- name: Get Deployment Output and extract Values
137153
id: get_output
@@ -174,15 +190,15 @@ jobs:
174190
echo "Logged out from Azure."
175191
176192
177-
gp-tests:
193+
e2e-test:
178194
needs: deploy
179-
uses: ./.github/workflows/gp-test-automation.yml
195+
uses: ./.github/workflows/test-automation.yml
180196
with:
181197
DOCGEN_URL: ${{ needs.deploy.outputs.WEBAPP_URL }}
182198

183199
cleanup-deployment:
184200
if: always() && needs.deploy.outputs.RESOURCE_GROUP_NAME != ''
185-
needs: [deploy, gp-tests]
201+
needs: [deploy, e2e-test]
186202
runs-on: ubuntu-latest
187203
env:
188204
RESOURCE_GROUP_NAME: ${{ needs.deploy.outputs.RESOURCE_GROUP_NAME }}
@@ -364,7 +380,7 @@ jobs:
364380
365381
EMAIL_BODY=$(cat <<EOF
366382
{
367-
"body": "<p>Dear Team,</p><p>We would like to inform you that the DocGen Deployment Automation process has encountered an issue and has failed to complete successfully.</p><p><strong>Build URL:</strong> ${RUN_URL}<br> ${OUTPUT}</p><p>Please investigate the matter at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>"
383+
"body": "<p>Dear Team,</p><p>We would like to inform you that the DocGen Deployment Automation process has encountered an issue and has failed to complete successfully.</p><p><strong>Build URL:</strong> <a href=\"${RUN_URL}\">${RUN_URL}</a><br></p><p>Please investigate the matter at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>"
368384
}
369385
EOF
370386
)

.github/workflows/docker-build-and-push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build Docker and Optional Push
22

33
on:
44
push:
5-
branches: [main, dev, demo]
5+
branches: [main, dev, demo, deploy-and-test]
66
pull_request:
77
branches: [main, dev, demo]
88
types:
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Install dependencies
2828
run: |
2929
python -m pip install --upgrade pip
30-
pip install -r playwright-tests/requirements.txt
30+
pip install -r tests/e2e-test/requirements.txt
3131
3232
- name: Ensure browsers are installed
3333
run: python -m playwright install --with-deps chromium
@@ -45,7 +45,7 @@ jobs:
4545
id: test1
4646
run: |
4747
xvfb-run pytest --headed --html=report/report.html --self-contained-html
48-
working-directory: playwright-tests
48+
working-directory: tests/e2e-test
4949
continue-on-error: true
5050

5151
- name: Sleep for 30 seconds
@@ -58,7 +58,7 @@ jobs:
5858
id: test2
5959
run: |
6060
xvfb-run pytest --headed --html=report/report.html --self-contained-html
61-
working-directory: playwright-tests
61+
working-directory: tests/e2e-test
6262
continue-on-error: true
6363

6464
- name: Sleep for 60 seconds
@@ -71,15 +71,15 @@ jobs:
7171
id: test3
7272
run: |
7373
xvfb-run pytest --headed --html=report/report.html --self-contained-html
74-
working-directory: playwright-tests
74+
working-directory: tests/e2e-test
7575

7676
- name: Upload test report
7777
id: upload_report
7878
uses: actions/upload-artifact@v4
7979
if: ${{ !cancelled() }}
8080
with:
8181
name: test-report
82-
path: playwright-tests/report/*
82+
path: tests/e2e-test/report/*
8383

8484
- name: Send Notification on Failure
8585
if: always()
@@ -91,22 +91,22 @@ jobs:
9191
if [ "$IS_SUCCESS" = "true" ]; then
9292
EMAIL_BODY=$(cat <<EOF
9393
{
94-
"body": "<p>Dear Team,</p><p>We would like to inform you that the ${{ env.accelerator_name }} Test Automation process has completed successfully.</p><p><strong>Run URL:</strong> ${RUN_URL}<br> ${OUTPUT}</p><p><strong>Test Report:</strong> ${REPORT_URL}</p><p>Best regards,<br>Your Automation Team</p>",
94+
"body": "<p>Dear Team,</p><p>We would like to inform you that the ${{ env.accelerator_name }} Test Automation process has completed successfully.</p><p><strong>Run URL:</strong> <a href=\"${RUN_URL}\">${RUN_URL}</a><br></p><p><strong>Test Report:</strong> <a href=\"${REPORT_URL}\">${REPORT_URL}</a></p><p>Best regards,<br>Your Automation Team</p>",
9595
"subject": "${{ env.accelerator_name }} Test Automation - Success"
9696
}
9797
EOF
9898
)
9999
else
100100
EMAIL_BODY=$(cat <<EOF
101101
{
102-
"body": "<p>Dear Team,</p><p>We would like to inform you that the ${{ env.accelerator_name }} Test Automation process has encountered an issue and has failed to complete successfully.</p><p><strong>Run URL:</strong> ${RUN_URL}<br> ${OUTPUT}</p><p><strong>Test Report:</strong> ${REPORT_URL}</p><p>Please investigate the matter at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>",
102+
"body": "<p>Dear Team,</p><p>We would like to inform you that the ${{ env.accelerator_name }} Test Automation process has encountered an issue and has failed to complete successfully.</p><p><strong>Run URL:</strong> <a href=\"${RUN_URL}\">${RUN_URL}</a><br> ${OUTPUT}</p><p><strong>Test Report:</strong> <a href=\"${REPORT_URL}\">${REPORT_URL}</a></p><p>Please investigate the matter at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>",
103103
"subject": "${{ env.accelerator_name }} Test Automation - Failure"
104104
}
105105
EOF
106106
)
107107
fi
108108
109109
# Send the notification
110-
curl -X POST "${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL }}" \
110+
curl -X POST "${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}" \
111111
-H "Content-Type: application/json" \
112112
-d "$EMAIL_BODY" || echo "Failed to send notification"

playwright-tests/base/base.py

Lines changed: 0 additions & 114 deletions
This file was deleted.

playwright-tests/config/constants.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

playwright-tests/pages/homePage.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

playwright-tests/sample_dotenv_file.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,5 +164,5 @@ cython_debug/
164164
archive/
165165
report/
166166
screenshots/
167+
report.html
167168

168-
report.html
File renamed without changes.

0 commit comments

Comments
 (0)