Skip to content

Commit cfc026b

Browse files
michieldtatevikg1
andauthored
Update testing (#1080)
* add upgrade pipeline * rename pipeline * add basic 3.6 DB * update version * Add pipeline for upgrade from 3.6 to 3.7 testing (#1009) * change output * try without directory, so it takes the tmpdir * copy screenshot from tmp to artifact dir * copy as standard step * fix path * fix config * don't create user that exists * avoid step failing when no images found * be less verbose * update action versions * update local test setup * exclude the behat test tag on CI * exclude test output * add composer.json * fix deprecations * testing updates * remove old file * add two new feature files * ignore .env files * add smtp-sink * simplify constructor * add plugin tests * remove .disabled file * behat tests update * rename feature file * add more tests * tidy up * remove database argument * set path for files * copy screenshots * set to manually run the queue * add smtp-sink * set pageroot to avoid warning * set pageroot back. stops everything from working * set some timeouts and add step to refresh the page * add refresh the page * add php 8.4 * fix parse errors * mark as WIP * create directory for screenshots * show progress * remove duplicated action * add REST API * lint exclude * lint update + split * update phplint * upadte matrix values * increase timeouts * make 8.0 unsupported and 8.3 standard * add clicking save twice * try with firefox to avoid stale element error * go back to chrome * change should see into must see * decrease wait time * use debug version to enable VNC * set pageroot for CI * show the tab panel with the list created * remove timeouts from featurecontext, they are in behat.yml already * the panel is not there * mark ready * remove javascript tag * remove timeouts, add chrome to local testing * add chrome to local testing * remove javascript tag * remove pageroot setting * upload log as artifact * mark some failing ones as wip * makr another wip * typo * don't run all the time * anoteht typo * makr another one @wip. * create volume to map local code into the container * give example of env var * update README on testing * tidy up --------- Co-authored-by: Tatevik <[email protected]>
1 parent b473478 commit cfc026b

40 files changed

+101102
-447
lines changed

.github/workflows/build-release.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Setup Packages
3939
run: |
4040
cd $GITHUB_WORKSPACE
41-
sudo apt update && sudo apt install -y rsync
41+
sudo apt update && sudo apt install -y rsync postfix
4242
4343
- name: Cache Composer dependencies
4444
uses: actions/cache@v4
@@ -89,6 +89,7 @@ jobs:
8989
mkdir /tmp/screenshots
9090
chmod 777 /tmp/screenshots
9191
mkdir -p build/mails
92+
smtp-sink -c -d "output/mails/%Y%m%d%H/%M." 2500 1024 &
9293
./bin/start-selenium > output/selenium.log 2>&1 &
9394
sleep 5
9495
sudo php -S 0.0.0.0:80 -t public_html > /dev/null 2>&1 &
@@ -119,8 +120,8 @@ jobs:
119120
- name: Run Behat Tests ## problem encountered https://github.com/forceedge01/behat-fail-aid/issues/76
120121
run: |
121122
cd $GITHUB_WORKSPACE/tests
122-
../vendor/bin/behat -n -p chrome --strict --stop-on-failure --tags=@initialise
123-
../vendor/bin/behat -n -p chrome --strict --stop-on-failure --tags="~@initialise && ~@wip"
123+
../vendor/bin/behat -n -fprogress -p chrome --strict --stop-on-failure --tags=@initialise
124+
../vendor/bin/behat -n -fprogress -p chrome --strict --stop-on-failure --tags="~@initialise && ~@wip && ~@behattest"
124125
125126
- name: Upload the output
126127
if: always()

.github/workflows/main.yml

Lines changed: 59 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
name: CI
33

4-
on: [pull_request]
4+
on: [pull_request, push]
55

66
jobs:
77
test:
@@ -11,10 +11,18 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
php-version: ['7.4', '8.0', '8.1', '8.2']
14+
php-version: ['8.1', '8.2', '8.3']
1515
experimental: [false]
16+
unsupported: [false]
1617
include:
17-
- php-version: '8.3'
18+
- php-version: '7.4'
19+
unsupported: true
20+
experimental: false
21+
- php-version: '8.0'
22+
unsupported: true
23+
experimental: false
24+
- php-version: '8.4'
25+
unsupported: false
1826
experimental: true
1927

2028
steps:
@@ -30,7 +38,7 @@ jobs:
3038
- name: Setup Packages
3139
run: |
3240
sudo apt update
33-
sudo apt install -y rsync
41+
sudo apt -y install rsync postfix
3442
3543
- name: Install dependencies
3644
uses: php-actions/composer@v6
@@ -59,10 +67,8 @@ jobs:
5967
- name: Create Database
6068
run: |
6169
sudo systemctl start mysql.service
62-
sudo mysql -proot -e 'DROP DATABASE IF EXISTS phplistdb'
63-
sudo mysqladmin -proot create phplistdb
64-
sudo mysql -proot -e 'CREATE USER phplist@"%" IDENTIFIED BY "phplist"; GRANT ALL ON phplistdb.* TO phplist@"%"'
65-
continue-on-error: ${{ matrix.experimental }}
70+
sudo mysql -proot -e 'drop database if exists phplistdb; create database phplistdb;'
71+
sudo mysql -proot -e 'create user phplist@"%" identified by "phplist"; grant all on phplistdb.* to phplist@"%"'
6672
6773
- name: Set Bootlist Theme
6874
run: |
@@ -73,29 +79,52 @@ jobs:
7379
rm master.tar.gz
7480
continue-on-error: ${{ matrix.experimental }}
7581

82+
- name: Install the phpList4 based REST API
83+
run: |
84+
cd $GITHUB_WORKSPACE
85+
cd public_html/lists
86+
wget https://github.com/phpList/base-distribution/archive/refs/heads/main.zip
87+
unzip main.zip
88+
rm main.zip
89+
mv base-distribution-main base
90+
cd base
91+
composer update --no-dev
92+
if: ${{ matrix.unsupported == false }}
93+
7694
- name: Start Test Server
7795
run: |
7896
cp -fv tests/ci/behat.yml tests/behat.yml
7997
cp -fv tests/ci/config.php public_html/lists/config/config.php
8098
mkdir -p output/screenshots
81-
mkdir -p build/mails
82-
chmod -R 777 output/screenshots build/mails
99+
mkdir -p /tmp/screenshots/
100+
touch output/screenshots/README.md
101+
mkdir -p output/mails
102+
smtp-sink -c -d "output/mails/%Y%m%d%H/%M." 2500 1024 &
83103
./bin/start-selenium > output/selenium.log 2>&1 &
84104
sleep 15
85105
sudo php -S 0.0.0.0:80 -t public_html > /dev/null 2>&1 &
86106
continue-on-error: ${{ matrix.experimental }}
87107

88108
- name: Check PHP syntax errors
89-
uses: overtrue/phplint@2.4.1
109+
uses: overtrue/phplint@3.0.0
90110
with:
91111
path: ./public_html
112+
options: --exclude=lists/base
113+
if: ${{ matrix.unsupported == false }}
114+
continue-on-error: ${{ matrix.experimental }}
115+
116+
- name: Check PHP syntax errors in API
117+
uses: overtrue/[email protected]
118+
with:
119+
path: ./public_html/lists/base/vendor/phplist
120+
if: ${{ matrix.unsupported == false }}
92121
continue-on-error: ${{ matrix.experimental }}
93122

94123
- name: Run BDD Tests UI
95124
run: |
96125
cd tests
97126
../vendor/bin/behat -p chrome -f progress --stop-on-failure --tags=@initialise
98-
../vendor/bin/behat -p chrome -f progress --tags="~@initialise && ~@wip"
127+
../vendor/bin/behat -p chrome -f progress --tags="~@initialise && ~@wip && ~@behattest"
99128
continue-on-error: ${{ matrix.experimental }}
100129

101130
- name: Run BDD Tests CLI
@@ -106,9 +135,17 @@ jobs:
106135
export ADMIN_NAME="phpList Administrator"
107136
php public_html/lists/admin/index.php -c public_html/lists/config/config.php -p initialise -f
108137
cd tests
109-
../vendor/bin/behat -p chrome --tags="~@initialise && ~@wip"
138+
../vendor/bin/behat -p chrome -f progress --tags="~@initialise && ~@wip"
110139
continue-on-error: ${{ matrix.experimental }}
111140

141+
- name: copy screenshots
142+
if: always()
143+
run: |
144+
cd $GITHUB_WORKSPACE
145+
images=$(ls -l /tmp/*.png 2>/dev/null | wc -l)
146+
[[ $images -gt 0 ]] && cp -v /tmp/*.png output/screenshots
147+
exit 0;
148+
112149
- name: Handle Experimental Warnings
113150
if: ${{ matrix.experimental && failure() }}
114151
run: |
@@ -118,12 +155,14 @@ jobs:
118155
if: always()
119156
uses: actions/upload-artifact@v4
120157
with:
121-
path: "output"
122-
name: "behat output ${{ matrix.php-version }}"
158+
path: "/tmp/screenshots/"
159+
name: "screenshots ${{ matrix.php-version }}"
123160
retention-days: 3
124161

125-
- name: Display Output on Failure
126-
if: failure() && !matrix.experimental
127-
run: |
128-
find . -type f
129-
cat output/selenium.log
162+
- name: Upload the Selenium Logs
163+
if: always()
164+
uses: actions/upload-artifact@v4
165+
with:
166+
path: "output/selenium.log"
167+
name: "selenium log ${{ matrix.php-version }}"
168+
retention-days: 3

.github/workflows/upgrade.yml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
2+
name: Upgrade
3+
4+
on:
5+
workflow_dispatch:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-22.04
10+
continue-on-error: ${{ matrix.experimental }}
11+
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
php-version: ['8.1']
16+
experimental: [false]
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up PHP ${{ matrix.php-version }}
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: ${{ matrix.php-version }}
24+
env:
25+
COMPOSER_TOKEN: ${{ secrets.COMPOSER_TOKEN }}
26+
27+
- name: Setup Packages
28+
run: |
29+
cd $GITHUB_WORKSPACE
30+
sudo apt update
31+
sudo apt install -y rsync postfix
32+
33+
# - name: Cache Composer dependencies
34+
# uses: actions/cache@v2
35+
# with:
36+
# path: /tmp/composer-cache
37+
# key: ${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
38+
39+
- name: Install dependencies
40+
uses: php-actions/composer@v6
41+
with:
42+
dev: yes
43+
args: --prefer-dist --no-interaction
44+
php_version: ${{ matrix.php-version }}
45+
php_extensions: xml
46+
version: 2
47+
48+
- name: Report Versions and show ENV vars
49+
run: |
50+
google-chrome --version
51+
lsb_release -a
52+
php -v
53+
chromedriver -v
54+
geckodriver -V
55+
which geckodriver
56+
which chromedriver
57+
firefox -v
58+
vendor/bin/behat -V
59+
mysql --version
60+
mysqladmin --version
61+
export
62+
63+
- name: Create Database
64+
run: |
65+
sudo systemctl start mysql.service
66+
sudo mysql -proot -e 'drop database if exists phplistdb; create database phplistdb;'
67+
sudo mysql -proot -e 'create user phplist@"%" identified by "phplist"; grant all on phplistdb.* to phplist@"%"'
68+
sudo gunzip -c tests/phplist-3.6.sql.gz | sudo mysql -proot phplistdb
69+
70+
- name: Set bootlist theme
71+
run: |
72+
cd $GITHUB_WORKSPACE/public_html/lists/admin/ui/
73+
wget https://github.com/phpList/phplist-ui-bootlist/archive/master.tar.gz
74+
tar -xzf master.tar.gz
75+
mv phplist-ui-bootlist-master phplist-ui-bootlist
76+
rm master.tar.gz
77+
78+
- name: Start Test Server
79+
run: |
80+
cd $GITHUB_WORKSPACE
81+
cp -fv tests/ci/behat.yml tests/behat.yml
82+
cp -fv tests/ci/config.php public_html/lists/config/config.php
83+
mkdir -p output/screenshots
84+
touch output/screenshots/README.md
85+
mkdir -p build/mails
86+
smtp-sink -c -d "output/mails/%Y%m%d%H/%M." 2500 1024 &
87+
./bin/start-selenium > output/selenium.log 2>&1 &
88+
sleep 5
89+
sudo php -S 0.0.0.0:80 -t public_html > /dev/null 2>&1 &
90+
91+
- name: Check PHP syntax errors
92+
uses: overtrue/[email protected]
93+
with:
94+
path: ./public_html
95+
96+
- name: Upgrade from 3.6 to 3.7
97+
run: |
98+
php public_html/lists/admin/index.php -c $GITHUB_WORKSPACE/public_html/lists/config/config.php -p upgrade
99+
100+
- name: Run BDD Tests UI
101+
run: |
102+
cd $GITHUB_WORKSPACE/tests
103+
../vendor/bin/behat -p chrome -f progress --tags="~@initialise && ~@wip"
104+
105+
- name: Reset Database
106+
run: |
107+
sudo mysql -proot -e 'drop database if exists phplistdb; create database phplistdb;'
108+
109+
- name: Run BDD Tests UI
110+
run: |
111+
cd $GITHUB_WORKSPACE/tests
112+
../vendor/bin/behat -p chrome -f progress --stop-on-failure --tags=@initialise
113+
../vendor/bin/behat -p chrome -f progress --tags="~@initialise && ~@wip"
114+
115+
- name: Run BDD Tests CLI
116+
run: |
117+
cd $GITHUB_WORKSPACE
118+
119+
export ADMIN_PASSWORD=Mypassword123+
120+
export ORGANISATION_NAME="phpList"
121+
export ADMIN_NAME="phpList Administrator"
122+
php public_html/lists/admin/index.php -c $GITHUB_WORKSPACE/public_html/lists/config/config.php -p initialise -f
123+
cd $GITHUB_WORKSPACE/tests
124+
../vendor/bin/behat -p chrome -f progress --tags="~@initialise && ~@wip"
125+
126+
- name: copy screenshots
127+
if: always()
128+
run: |
129+
cd $GITHUB_WORKSPACE
130+
images=$(ls -l /tmp/*.png 2>/dev/null | wc -l)
131+
[[ $images -gt 0 ]] && cp -v /tmp/*.png output/screenshots
132+
exit 0;
133+
134+
- name: Upload the screenshots
135+
if: always()
136+
uses: actions/upload-artifact@v4
137+
with:
138+
path: "output"
139+
name: "behat output ${{ matrix.php-version }}"
140+
retention-days: 3
141+
142+
- name: Display output
143+
run: |
144+
cd $GITHUB_WORKSPACE
145+
# find . -type f
146+
# cat output/selenium.log
147+
if: ${{ failure() }}
148+
149+

Dockerfile.release

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ FROM debian:bookworm-slim
33

44
LABEL maintainer="[email protected]"
55

6-
RUN apt-get update && apt-get upgrade -y
7-
8-
RUN apt-get install -y apt-utils \
6+
RUN apt-get update && apt-get upgrade -y && apt-get install -y apt-utils \
97
apache2 php-mysql \
108
libapache2-mod-php php-curl php-gd \
119
cron php-imap php-xml php-zip php-mbstring

0 commit comments

Comments
 (0)