-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (133 loc) · 4.92 KB
/
Copy pathtests.yml
File metadata and controls
155 lines (133 loc) · 4.92 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
name: Tests
on:
push:
branches:
- main
- 'feature/**'
- 'fix/**'
- 'ci/**'
pull_request:
schedule:
# Nightly. This repository ships by tag, not by release: a framework
# released after this plugin was tagged can break it without a single
# commit landing here, and nothing else would notice.
- cron: '0 4 * * *'
workflow_dispatch:
permissions:
contents: read
jobs:
contract:
name: Contract
runs-on: ubuntu-latest
# The scaffolder copies this file into every generated plugin, where it
# would fail on the first push for reasons that have nothing to do with
# the user's plugin.
if: github.repository == 'Pollora/plugin-default'
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
coverage: none
# No Composer install, no database, no site: these are properties of the
# files in this repository, and they run in about a second.
- name: Contract tests
run: php bin/tests/run.php
install:
name: Install (skeleton ${{ matrix.skeleton }})
runs-on: ubuntu-latest
if: github.repository == 'Pollora/plugin-default'
# `make:plugin` downloads this repository's latest tag onto whatever site
# asks for it, so the plugin has to activate on two generations of
# framework at once: 13.4, which has no `pollora_register()`, and the
# current one, which has nothing else.
strategy:
fail-fast: false
matrix:
skeleton: ['v13.4.0', 'dev-main']
steps:
- name: Checkout the plugin
uses: actions/checkout@v6
with:
path: plugin
- name: Setup DDEV
uses: ddev/github-action-setup-ddev@v1
with:
autostart: false
# --no-install and --no-scripts: the skeleton's install hooks want a
# database, and there is none until DDEV is up.
- name: Create the skeleton
run: |
composer create-project pollora/pollora site '${{ matrix.skeleton }}' \
--no-install --no-scripts --no-interaction
- name: Configure DDEV
working-directory: site
run: |
ddev config \
--project-name=pollora-plugin \
--project-type=wordpress \
--docroot=public \
--php-version=8.4 \
--webserver-type=apache-fpm \
--database=mariadb:10.11 \
--nodejs-version=22 \
--disable-settings-management
- name: Start DDEV
working-directory: site
run: ddev start
- name: Prepare .env
working-directory: site
run: |
cp .env.example .env
sed -i \
-e 's#^APP_URL=.*#APP_URL=https://pollora-plugin.ddev.site#' \
-e 's#^DB_CONNECTION=.*#DB_CONNECTION=mysql#' \
-e 's/^# DB_HOST=.*/DB_HOST=db/' \
-e 's/^# DB_PORT=.*/DB_PORT=3306/' \
-e 's/^# DB_DATABASE=.*/DB_DATABASE=db/' \
-e 's/^# DB_USERNAME=.*/DB_USERNAME=db/' \
-e 's/^# DB_PASSWORD=.*/DB_PASSWORD=db/' \
.env
- name: Install Composer dependencies
working-directory: site
run: ddev composer install --no-interaction --no-progress
- name: Generate application key
working-directory: site
run: ddev exec php artisan key:generate --no-interaction
# On framework 13.4 this command installs WordPress and then exits 1:
# its last step calls `pollora:make-theme` with no name, which Symfony
# rejects when it cannot prompt. The gate below is what actually matters,
# and it is checked separately rather than being inferred from the exit
# code.
- name: Install WordPress
working-directory: site
run: |
ddev exec php artisan pollora:install --install \
--title="Plugin CI" \
--description="Pollora plugin CI" \
--admin-user=admin \
--admin-email=admin@example.com \
--admin-password=pollora-plugin-ci \
--locale=en_US \
--public=false \
--no-interaction || true
ddev exec wp core is-installed
# The scaffolder can only download a tag, so without --source this job
# would measure the last release and report it as the branch being green.
- name: Place the commit under test where the container can reach it
run: cp -r plugin site/plugin-under-test
- name: Install check
working-directory: site
run: |
ddev exec bash -c '
php plugin-under-test/bin/ci/check-install.php \
--url=https://pollora-plugin.ddev.site \
--name=ci-plugin \
--source=/var/www/html/plugin-under-test
'
- name: Laravel log
if: failure()
working-directory: site
run: tail -n 200 storage/logs/laravel.log || true