-
Notifications
You must be signed in to change notification settings - Fork 3
65 lines (54 loc) · 2.01 KB
/
qit-environment-dangling-test.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
name: QIT Environment Dangling Test
on:
# Every day at 11pm UTC (6pm ET)
schedule:
- cron: '0 23 * * *'
# Manually
workflow_dispatch:
jobs:
environment_dangling_tests:
runs-on: ubuntu-latest
env:
NO_COLOR: 1
QIT_DISABLE_ONBOARDING: yes
steps:
- name: Checkout code (Cross-platform)
uses: actions/checkout@v4
- name: Setup PHP (Cross-platform)
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- name: Composer install (Unix)
working-directory: src
run: composer install
- name: Enable dev mode
working-directory: src
run: php qit-cli.php dev
- name: Connect to Staging QIT
working-directory: src
run: php qit-cli.php backend:add --environment="staging" --qit_secret="${{ secrets.QIT_STAGING_SECRET }}" --manager_url="https://stagingcompatibilitydashboard.wpcomstaging.com"
- name: Add "qit.test" to hosts file (Linux)
run: sudo echo "127.0.0.1 qit.test" | sudo tee -a /etc/hosts
- name: Start environment
working-directory: src
run: php qit-cli.php env:up
- name: Test Site Up
run: |
# Fetch the site URL
SITE_URL=$(php qit-cli.php env:list --field=site_url)
echo "Site URL: $SITE_URL"
# Assert home page is 200
HTTP_STATUS=$(curl -o /dev/null -s -w "%{http_code}\n" $SITE_URL)
if [ "$HTTP_STATUS" -ne 200 ]; then
echo "Home page is not up. HTTP status: $HTTP_STATUS"
exit 1
fi
echo "Home page is up. HTTP status: $HTTP_STATUS"
# Assert the name property in the JSON response
JSON_RESPONSE=$(curl -s $SITE_URL/wp-json)
NAME_PROPERTY=$(echo $JSON_RESPONSE | jq -r '.name')
if [ "$NAME_PROPERTY" != "WooCommerce Core E2E Test Suite" ]; then
echo "Name property does not match. Found: $NAME_PROPERTY"
exit 1
fi
echo "Name property matches: $NAME_PROPERTY"