-
Notifications
You must be signed in to change notification settings - Fork 1
198 lines (169 loc) · 6.17 KB
/
Copy pathe2e.yml
File metadata and controls
198 lines (169 loc) · 6.17 KB
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: E2E Tests
on:
pull_request:
branches:
- main
paths:
- 'src/**'
- 'e2e/**'
- '.devcontainer/**'
- 'composer.json'
- 'composer.lock'
- 'manifest.xml'
- 'bundle.sh'
- 'bundle.php'
- '.github/workflows/e2e.yml'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
e2e:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
joomla:
- version: "5"
php-version: "8.3"
joomla-version: "5.4.6"
- version: "6"
php-version: ""
joomla-version: ""
name: E2E (Joomla ${{ matrix.joomla.version }})
steps:
- name: Checkout
uses: actions/checkout@v6
# Prepare host environment
- name: Create required directories and certificates
working-directory: .devcontainer
run: |
mkdir -p joomla/logs
./generate-certs.sh .secrets
echo "127.0.0.1 www.dev.local auth.dev.local" | sudo tee -a /etc/hosts
# Docker image preparation
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build Joomla image
uses: docker/build-push-action@v7
with:
context: .devcontainer/joomla
build-args: |
${{ matrix.joomla.joomla-version != '' && format('JOOMLA_VERSION={0}', matrix.joomla.joomla-version) || '' }}
${{ matrix.joomla.php-version != '' && format('PHP_VERSION={0}', matrix.joomla.php-version) || '' }}
load: true
tags: joomla:external-login
cache-from: type=gha,scope=joomla-${{ matrix.joomla.version }}
cache-to: type=gha,mode=max,scope=joomla-${{ matrix.joomla.version }}
- name: Build Keycloak image
uses: docker/build-push-action@v7
with:
context: .devcontainer/keycloak
load: true
tags: keycloak:cas
cache-from: type=gha,scope=keycloak
cache-to: type=gha,mode=max,scope=keycloak
# Start services and install applications
- name: Start Docker Compose services
working-directory: .devcontainer
run: docker compose up -d --no-build
- name: Setup Joomla and install extension
run: .devcontainer/joomla/install.sh
# E2E test preparation
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
- name: Enable Corepack
run: corepack enable pnpm
- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Cache pnpm store
uses: actions/cache@v5
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('e2e/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install E2E dependencies
working-directory: e2e
run: pnpm install
- name: Get Playwright version
working-directory: e2e
run: echo "PLAYWRIGHT_VERSION=$(pnpm exec playwright --version | cut -d' ' -f2)" >> $GITHUB_ENV
- name: Cache Playwright browsers
uses: actions/cache@v5
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
- name: Install Playwright browsers and dependencies
working-directory: e2e
run: |
if [ "${{ steps.playwright-cache.outputs.cache-hit }}" != 'true' ]; then
echo "Cache miss - Installing browsers with system dependencies..."
pnpm exec playwright install --with-deps chromium
else
echo "Cache hit - Installing system dependencies only..."
pnpm exec playwright install-deps chromium
fi
- name: Run E2E tests
working-directory: e2e
run: pnpm test
- name: Upload Playwright report
uses: actions/upload-artifact@v7
if: always()
with:
name: playwright-report-joomla-${{ matrix.joomla.version }}
path: e2e/playwright-report/
retention-days: 7
- name: Upload test results
uses: actions/upload-artifact@v7
if: failure()
with:
name: test-results-joomla-${{ matrix.joomla.version }}
path: e2e/test-results/
retention-days: 7
- name: Collect diagnostic information on failure
if: failure()
working-directory: .devcontainer
run: |
echo "=================================================="
echo "Diagnostic Information Collection (Joomla ${{ matrix.joomla.version }})"
echo "=================================================="
echo ""
echo "=== Container Status ==="
docker compose ps
echo ""
echo "=== Joomla Container Logs (last 100 lines) ==="
docker compose logs joomla --tail=100
echo ""
echo "=== Keycloak Container Logs (last 100 lines) ==="
docker compose logs keycloak --tail=100
echo ""
echo "=== MySQL Container Logs (last 50 lines) ==="
docker compose logs mysql --tail=50
echo ""
echo "=== Joomla Error Logs ==="
docker compose exec joomla sh -c 'tail -100 /var/www/html/administrator/logs/everything.php 2>/dev/null || echo "No Joomla error logs found"'
echo ""
echo "=================================================="
echo "Diagnostic collection completed"
echo "=================================================="
- name: Upload diagnostic logs
if: failure()
uses: actions/upload-artifact@v7
with:
name: diagnostic-logs-joomla-${{ matrix.joomla.version }}
path: |
.devcontainer/joomla/logs/
retention-days: 7
if-no-files-found: ignore
- name: Stop Docker Compose services
if: always()
working-directory: .devcontainer
run: docker compose down -v