Repository navigation
89 lines (77 loc) · 2.55 KB
/
Copy pathcontainer-tests.yml
File metadata and controls
89 lines (77 loc) · 2.55 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
name: Container Tests
on:
push:
branches:
- master
pull_request:
branches:
- master
paths:
- '**.php'
- 'compose.yaml'
- 'docker/**'
- '.dockerignore'
- '.github/workflows/container-tests.yml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
permissions: {}
jobs:
# Builds the runner image and runs prepare.php, test.php, report.php, and
# cleanup.php against a database container, mimicking a hosting environment.
#
# Each step's output, junit.xml, env.json, and a Markdown summary are
# uploaded as an artifact, and the summary is shown on the workflow run.
#
# The job fails when a runner step fails, not when WordPress tests fail.
test:
name: PHP ${{ matrix.php }} / ${{ matrix.db }}
runs-on: ubuntu-24.04
timeout-minutes: 60
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- php: '8.3'
db: 'mysql:8.4'
- php: '8.1'
db: 'mariadb:10.6'
env:
PHP_VERSION: ${{ matrix.php }}
WPT_DB_IMAGE: ${{ matrix.db }}
# Failing WordPress tests are shown in the summary, but only problems with
# the runner itself, or a test run without junit.xml results, fail the job.
WPT_IGNORE_TEST_FAILURES: 1
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
- name: Build the runner image
run: WPT_UID="$(id -u)" docker compose build runner
- name: Run the test runner
run: |
mkdir -p output
docker compose up --abort-on-container-exit --exit-code-from runner
- name: Add the summary to the job
if: ${{ always() }}
run: |
if [ -f output/summary.md ]; then
cat output/summary.md >> "$GITHUB_STEP_SUMMARY"
else
echo "The runner did not produce a summary." >> "$GITHUB_STEP_SUMMARY"
fi
- name: Upload the results
if: ${{ always() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: results-php${{ matrix.php }}-${{ strategy.job-index }}
path: output/
if-no-files-found: warn
- name: Remove the containers
if: ${{ always() }}
run: docker compose down --volumes