Skip to content

Commit 05ff7de

Browse files
authored
Merge pull request #16 from joanhey/gh-action
Github action to test the setup and frameworks
2 parents 5450155 + a821d4d commit 05ff7de

File tree

5 files changed

+71
-9
lines changed

5 files changed

+71
-9
lines changed

.github/workflows/test.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Test PHP benchmark
2+
on: [ push, pull_request ]
3+
4+
jobs:
5+
setup:
6+
name: Check PHP frameworks
7+
runs-on: ubuntu-22.04
8+
9+
steps:
10+
11+
- uses: actions/checkout@v3
12+
13+
- name: Install WRK
14+
run: sudo apt-get install wrk w3m
15+
16+
- name: Setup PHP
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: 8.2
20+
extensions: dom, curl, libxml, mbstring, zip, pcntl, ctype, iconv, intl
21+
coverage: none
22+
23+
- name: Install Apache mod_php
24+
run: |
25+
LC_ALL=C.UTF-8 sudo apt-add-repository http://ppa.launchpad.net/ondrej/php/ubuntu
26+
sudo apt install libapache2-mod-php8.2
27+
sudo a2enmod php8.2 rewrite
28+
shell: bash
29+
30+
- name: Setup frameworks
31+
run: bash setup.sh
32+
33+
- name: Copy files to web root
34+
run: |
35+
sudo mkdir /var/www/html/PHP-Frameworks-Bench
36+
sudo cp -R ./* /var/www/html/PHP-Frameworks-Bench/
37+
sudo chown -R www-data:www-data /var/www/html
38+
39+
- name: Restart apache server
40+
run: sudo service apache2 restart
41+
42+
- name: Check frameworks
43+
run: bash check.sh
44+

check.sh

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,38 @@
33
. ./benchmark.config
44
. ./base/option_target.sh
55

6+
OK='\U2714'
7+
ERROR='\U274C'
8+
9+
GREEN='\033[0;32m'
10+
RED='\033[0;31m'
11+
NC='\033[0m' # No Color
12+
13+
FAIL=0
14+
615
for fw in `echo $param_targets`
716
do
817
if [ -d "$fw" ]; then
9-
echo -n "/------- $fw: checking... "
1018
. "$fw/_benchmark/hello_world.sh"
1119

1220
url_output=$(curl -s "$url")
1321

1422
# expected to get the Hello World! + libs/output_data.php
1523
if ! [[ "$url_output" =~ ^('Hello World!')(.*)(([0-9]*):(([0-9]+([.][0-9]*)?|[.][0-9]+)):([0-9]*))$ ]]; then
16-
echo -e "error: \n$url"
17-
echo "$url_output"
24+
echo -e "${RED}${ERROR} $fw ${NC}"
25+
echo "$url"
26+
27+
if [ -x "$(command -v w3m)" ]; then
28+
echo "$url_output" | w3m -dump -T text/html
29+
else
30+
echo "$url_output"
31+
fi
32+
33+
FAIL=1
1834
else
19-
echo "done."
35+
echo -e "${GREEN}${OK} $fw ${NC}"
2036
fi
2137
fi
22-
done
38+
done
39+
40+
exit $FAIL

fuelphp-1.9/_benchmark/fuel/fuel/app/logs/.gitkeep

Whitespace-only changes.

laravel-10.0/_benchmark/setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ yes|cp -rf _benchmark/laravel/. ./
1010
# some enhancements
1111
composer install --optimize-autoloader --no-dev
1212
chmod o+w storage/*
13-
sudo chmod o+w storage/framework/*
14-
php artisan optimize
13+
chmod o+w storage/framework/*
14+
#php artisan optimize
1515
rm ./public/.htaccess

laravel-10.0/_benchmark/update.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ yes|cp -rf _benchmark/laravel/. ./
77
# some enhancements
88
composer install --optimize-autoloader --no-dev
99
chmod o+w storage/*
10-
sudo chmod o+w storage/framework/*
11-
php artisan optimize
10+
chmod o+w storage/framework/*
11+
#php artisan optimize
1212
rm ./public/.htaccess

0 commit comments

Comments
 (0)