-
Notifications
You must be signed in to change notification settings - Fork 2
75 lines (64 loc) · 2.06 KB
/
qit-environment-test-linux.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
name: QIT Environment Test - Linux
on:
# Every day at 11am and 11pm UTC (6am and 6pm ET)
schedule:
- cron: '0 11 * * *'
- cron: '0 23 * * *'
# Manually
workflow_dispatch:
# On push to trunk
push:
branches:
- trunk
jobs:
environment_tests:
runs-on: ubuntu-20.04
env:
NO_COLOR: 1
QIT_DISABLE_ONBOARDING: yes
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.2'
- name: Composer install
working-directory: _tests
run: composer install
- name: Enable dev mode
run: ./qit dev
- name: Connect to Staging QIT
run: ./qit backend:add --environment="staging" --qit_secret="${{ secrets.QIT_STAGING_SECRET }}" --manager_url="https://stagingcompatibilitydashboard.wpcomstaging.com"
- name: Add "qit.test" to /etc/hosts
run: sudo echo "127.0.0.1 qit.test" | sudo tee -a /etc/hosts
- name: Start environment and get URL
run: |
ENV_OUTPUT=$(./qit env:up --json)
if [ $? -ne 0 ]; then
echo "Failed to start environment"
echo "$ENV_OUTPUT"
exit 1
fi
echo "Raw environment output: $ENV_OUTPUT"
NGINX_PORT=$(echo "$ENV_OUTPUT" | jq -r '.nginx_port')
if [ -z "$NGINX_PORT" ] || [ "$NGINX_PORT" = "null" ]; then
echo "nginx_port not found in environment output"
exit 1
fi
echo "NGINX_PORT=$NGINX_PORT" >> $GITHUB_ENV
- name: Print nginx_port
run: |
echo "Nginx port: $NGINX_PORT"
- name: Test Site Up
run: |
STATUS_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://qit.test:$NGINX_PORT/)
if [ "$STATUS_CODE" -eq 200 ]; then
echo "Site is up"
else
echo "Site is not up, status code: $STATUS_CODE"
exit 1
fi
- name: Query WP JSON
run: |
curl -s "http://qit.test:$NGINX_PORT/wp-json"