Skip to content

Commit 49fc3ac

Browse files
committed
Added debug
1 parent c670f38 commit 49fc3ac

1 file changed

Lines changed: 77 additions & 62 deletions

File tree

.github/workflows/test.yml

Lines changed: 77 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -49,43 +49,97 @@ jobs:
4949
e2e:
5050
name: E2E
5151
runs-on: ubuntu-latest
52+
5253
steps:
5354
- name: Checkout
5455
uses: actions/checkout@v4
5556

5657
- name: Start WordPress
5758
run: docker compose up -d
5859

59-
- name: Wait for WordPress
60+
- name: Wait for HTTP
6061
run: |
6162
for i in $(seq 1 60); do
6263
if curl -sf -o /dev/null --connect-timeout 2 http://127.0.0.1:8071/; then
63-
echo "WordPress responding"
64+
echo "HTTP responding"
6465
break
6566
fi
66-
if [ $i -eq 60 ]; then exit 1; fi
67-
sleep 5
67+
68+
if [ $i -eq 60 ]; then
69+
echo "HTTP timeout"
70+
docker compose logs --no-color
71+
exit 1
72+
fi
73+
74+
sleep 2
6875
done
69-
sleep 5
7076
71-
- name: Install WordPress
77+
- name: Bootstrap WordPress (install + plugin)
7278
run: |
73-
docker compose exec -T wordpress bash -c 'cd /var/www/html && \
74-
(command -v wp >/dev/null 2>&1 || (curl -sO https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && chmod +x wp-cli.phar && mv wp-cli.phar /usr/local/bin/wp)) && \
75-
wp core install --url=http://127.0.0.1:8071 --title=Test --admin_user=test --admin_password=asdf123jkl --admin_email=test@test.test --skip-email --allow-root 2>/dev/null || true && \
76-
wp plugin activate fapi-signals --allow-root 2>/dev/null || true'
77-
sleep 3
79+
docker compose exec -T wordpress bash -lc '
80+
set -e
81+
cd /var/www/html
82+
83+
# Install WP-CLI if missing
84+
if ! command -v wp >/dev/null 2>&1; then
85+
curl -sSLo /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
86+
chmod +x /usr/local/bin/wp
87+
fi
7888
79-
- name: Wait for wp-admin
89+
# Wait for database connection (max ~60s)
90+
for i in {1..30}; do
91+
if wp db check --allow-root >/dev/null 2>&1; then
92+
echo "Database ready"
93+
break
94+
fi
95+
96+
if [ "$i" -eq 30 ]; then
97+
echo "Database timeout"
98+
exit 1
99+
fi
100+
101+
sleep 2
102+
done
103+
104+
# Install WordPress only if not installed
105+
if ! wp core is-installed --allow-root >/dev/null 2>&1; then
106+
wp core install \
107+
--url="http://127.0.0.1:8071" \
108+
--title="Test" \
109+
--admin_user="test" \
110+
--admin_password="asdf123jkl" \
111+
--admin_email="test@test.test" \
112+
--skip-email \
113+
--allow-root
114+
else
115+
echo "WordPress already installed"
116+
fi
117+
118+
# Activate plugin
119+
wp plugin activate fapi-signals --allow-root
120+
121+
echo "WordPress + plugin ready"
122+
'
123+
124+
- name: Wait for wp-login.php
80125
run: |
81126
for i in $(seq 1 36); do
82-
code=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 5 --max-time 10 http://127.0.0.1:8071/wp-login.php || echo "000")
83-
if echo "$code" | grep -qE '^200$'; then
84-
echo "wp-admin ready (wp-login.php returned $code)"
127+
code=$(curl -s -o /dev/null -w "%{http_code}" \
128+
--connect-timeout 5 --max-time 10 \
129+
http://127.0.0.1:8071/wp-login.php || echo "000")
130+
131+
if [ "$code" = "200" ]; then
132+
echo "wp-login.php ready"
85133
break
86134
fi
87-
if [ $i -eq 36 ]; then echo "wp-admin timeout (last code: $code)"; exit 1; fi
88-
sleep 5
135+
136+
if [ $i -eq 36 ]; then
137+
echo "wp-login.php timeout (last code: $code)"
138+
docker compose logs --no-color
139+
exit 1
140+
fi
141+
142+
sleep 2
89143
done
90144
91145
- name: Setup Node
@@ -100,57 +154,18 @@ jobs:
100154
- name: Install Playwright browsers
101155
run: npx playwright install --with-deps
102156

103-
- name: Playwright E2E
157+
- name: Run Playwright E2E
104158
env:
105159
CI: true
106160
WP_BASE_URL: http://127.0.0.1:8071
107161
WP_ADMIN_USER: test
108162
WP_ADMIN_PASS: asdf123jkl
109163
run: npm run test:e2e
110164

165+
- name: Debug logs (only on failure)
166+
if: failure()
167+
run: docker compose logs --no-color
168+
111169
- name: Stop WordPress
112170
if: always()
113-
run: docker compose down
114-
115-
deploy-wporg:
116-
name: Deploy to WordPress.org
117-
runs-on: ubuntu-latest
118-
if: false
119-
needs: [php]
120-
steps:
121-
- name: Checkout
122-
uses: actions/checkout@v4
123-
124-
- name: Prepare build directory
125-
run: |
126-
mkdir -p wporg/trunk wporg/assets wporg/tags
127-
rsync -av --delete \
128-
--exclude "wporg/" \
129-
--exclude ".git/" \
130-
--exclude ".github/" \
131-
--exclude "node_modules/" \
132-
--exclude "tests/" \
133-
--exclude "e2e/" \
134-
--exclude "test-results/" \
135-
--exclude "docker-compose.yml" \
136-
--exclude "Dockerfile" \
137-
--exclude "README.md" \
138-
--exclude "SPECIFICATION.md" \
139-
--exclude "package.json" \
140-
--exclude "package-lock.json" \
141-
--exclude "playwright.config.js" \
142-
--exclude "phpunit.xml" \
143-
--exclude ".phpunit.result.cache" \
144-
--exclude ".env" \
145-
--exclude ".gitignore" \
146-
--exclude ".cursorignore" \
147-
./ wporg/trunk/
148-
149-
- name: Deploy to WordPress.org SVN
150-
uses: 10up/action-wordpress-plugin-deploy@stable
151-
env:
152-
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
153-
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
154-
SLUG: fapi-signals
155-
BUILD_DIR: wporg/trunk
156-
ASSETS_DIR: wporg/assets
171+
run: docker compose down

0 commit comments

Comments
 (0)