Skip to content

Commit 74176b9

Browse files
authored
Merge pull request #45 from igorhrcek/issue-7
Issue 7
2 parents 2c134df + 808b561 commit 74176b9

18 files changed

+280
-5223
lines changed

.env.ci

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
WORDPRESS_NGINX_PATH=../wordpress
2+
WORDPRESS_NGINX_URL=http://localhost:8080
3+
WORDPRESS_APACHE_PATH=../wordpress
4+
WORDPRESS_APACHE_URL=http://localhost:8080

.github/workflows/apache.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Apache tests
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
jobs:
7+
tests:
8+
runs-on: 'ubuntu-latest'
9+
services:
10+
mysql:
11+
image: mysql:5.7
12+
env:
13+
MYSQL_ROOT_PASSWORD: "rootpass"
14+
MYSQL_USER: "wordpress"
15+
MYSQL_PASSWORD: "wordpress"
16+
MYSQL_DATABASE: "wordpress"
17+
ports:
18+
- 3306:3306
19+
options: >-
20+
--mount type=tmpfs,destination=/var/lib/mysql
21+
--health-cmd "mysqladmin ping"
22+
--health-interval 10s
23+
--health-timeout 5s
24+
--health-retries 3
25+
wordpress:
26+
image: ghcr.io/igorhrcek/wordpress-docker-apache/wordpress-docker-apache:latest
27+
env:
28+
WORDPRESS_DB_HOST: mysql
29+
WORDPRESS_DB_USER: wordpress
30+
WORDPRESS_DB_PASSWORD: wordpress
31+
WORDPRESS_DB_NAME: wordpress
32+
ports:
33+
- 8080:80
34+
options:
35+
--name wordpress -v ${{ github.workspace }}/wordpress:/var/www/html
36+
steps:
37+
- uses: actions/checkout@v2
38+
with:
39+
path: 'codebase'
40+
41+
- name: Install dependencies
42+
run: |
43+
cd ${{ github.workspace }}/codebase && composer install && composer dump-autoload
44+
45+
- name: Copy .env files
46+
run: |
47+
cp -rf ${{ github.workspace }}/codebase/.env.ci ${{ github.workspace }}/codebase/.env
48+
49+
- name: Make .htaccess and nginx.conf writebable
50+
run: |
51+
sudo chown -R $USER:$USER ${{ github.workspace }}/wordpress
52+
53+
- name: Run PHPUnit tests
54+
run: |
55+
cd ${{ github.workspace }}/codebase && vendor/bin/phpunit --testdox --filter SecurityRulesApacheTest

.github/workflows/lint.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Lint
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
jobs:
7+
lint:
8+
runs-on: 'ubuntu-latest'
9+
strategy:
10+
matrix:
11+
php-versions: ['7.4', '8.0', '8.1']
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- name: Setup PHP
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: ${{ matrix.php-versions }}
19+
tools: composer,phpstan, phpcs
20+
- name: Install composer packages
21+
run: |
22+
composer update
23+
composer install
24+
- name: Lint and run checks with phpstan
25+
run: phpstan analyse src --level=5
26+
- name: Check codestyle with phpcs
27+
run: phpcs src

0 commit comments

Comments
 (0)