Skip to content

Commit 0b6cf9a

Browse files
committed
update project files
1 parent 17bb61f commit 0b6cf9a

18 files changed

+306
-381
lines changed

.env.test

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1-
DB_HOST=mysql
2-
DB_PORT=3306
1+
DB_HOST=database
32
DB_DATABASE=test
43
DB_USERNAME=test
54
DB_PASSWORD=test
5+
6+
SQLITE_DATABASE=./tests/database/database.sqlite
7+
8+
MYSQL_PORT=3306
9+
MARIADB_PORT=3306
10+
PGSQL_PORT=5432
11+
12+
SQLSRV_PORT=1433
13+
SQLSRV_USERNAME=SA
14+
SQLSRV_PASSWORD=MyS3cureP4ssw0rd
15+
SQLSRV_DATABASE=master
Lines changed: 10 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
name: "Check coverage"
22
on:
33
pull_request:
4-
types:
5-
- opened
6-
- reopened
7-
- edited
8-
- synchronize
9-
branches:
10-
- master
11-
- main
4+
types: [opened, reopened, edited, synchronize]
5+
branches: [master, main]
126
paths:
137
- src/**
148
- tests/**
@@ -17,52 +11,11 @@ concurrency:
1711
group: ${{ github.workflow }}-${{ github.ref }}
1812
cancel-in-progress: true
1913
jobs:
20-
coverage:
21-
runs-on: ubuntu-latest
22-
steps:
23-
- name: Checkout code
24-
uses: actions/checkout@v4
25-
- name: Start MySQL
26-
run: |
27-
sudo systemctl start mysql.service
28-
mysql -uroot -proot -e 'CREATE DATABASE test'
29-
mysql -uroot -proot -e "CREATE USER 'test'@'%' IDENTIFIED WITH mysql_native_password BY 'test'"
30-
mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON test.* TO 'test'@'%'"
31-
mysql -uroot -proot -e "FLUSH PRIVILEGES"
32-
- name: Setup PHP
33-
uses: shivammathur/setup-php@v2
34-
with:
35-
php-version: 8.2
36-
extensions: curl, zip, mbstring, pdo, pdo_mysql
37-
coverage: xdebug
38-
- name: Install dependencies
39-
run: |
40-
composer update --prefer-dist --no-interaction
41-
- name: Setup .env
42-
run: |
43-
sed -i -E "s/^DB_HOST=.*$/DB_HOST=127.0.0.1/g" .env.test
44-
- name: Enable PHPUnit coverage
45-
run: |
46-
sed -i "s/<\!--<coverage/<coverage/g" phpunit.xml
47-
sed -i "s/<\/coverage>-->/<\/coverage>/g" phpunit.xml
48-
- name: Execute tests
49-
run: vendor/bin/phpunit
50-
- name: Code coverage summary report
51-
uses: irongut/[email protected]
52-
with:
53-
filename: cobertura.xml
54-
badge: true
55-
format: markdown
56-
fail_below_min: false
57-
output: both
58-
- name: Add PR comment
59-
uses: marocchino/sticky-pull-request-comment@v2
60-
if: github.event_name == 'pull_request'
61-
with:
62-
recreate: true
63-
path: code-coverage-results.md
64-
- name: Fail below 50%
65-
uses: themichaelhall/check-code-coverage@v2
66-
with:
67-
report: clover.xml
68-
required-percentage: 50
14+
generate-coverage:
15+
name: "Generate coverage"
16+
uses: michaelbaril/shared/.github/workflows/run-tests.yml@main
17+
with:
18+
with-coverage: true
19+
check-coverage:
20+
needs: generate-coverage
21+
uses: michaelbaril/shared/.github/workflows/check-coverage.yml@main
Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,19 @@
11
name: "Check quality"
22
on:
33
push:
4-
branches:
5-
- master
6-
- main
4+
branches: [master, main]
75
paths:
86
- src/**
9-
- tests/**
107
- phpcs.xml
118
pull_request:
12-
types:
13-
- opened
14-
- reopened
15-
- edited
16-
- synchronize
17-
branches:
18-
- master
19-
- main
9+
types: [opened, reopened, edited, synchronize]
10+
branches: [master, main]
2011
paths:
2112
- src/**
22-
- tests/**
2313
- phpcs.xml
2414
concurrency:
2515
group: ${{ github.workflow }}-${{ github.ref }}
2616
cancel-in-progress: true
2717
jobs:
28-
quality:
29-
runs-on: ubuntu-latest
30-
steps:
31-
- name: Checkout code
32-
uses: actions/checkout@v4
33-
- name: Setup PHP
34-
uses: shivammathur/setup-php@v2
35-
with:
36-
php-version: 8.2
37-
extensions: curl, zip, mbstring, pdo, pdo_mysql
38-
tools: cs2pr
39-
coverage: none
40-
- name: Install dependencies
41-
run: |
42-
composer update --prefer-dist --no-interaction
43-
- name: PHP Code Sniffer
44-
run: ./vendor/bin/phpcs -q --report=checkstyle --standard=./phpcs.xml src | cs2pr
45-
# - name: PHPStan
46-
# run: ./vendor/bin/phpstan analyse --configuration=./phpstan.neon --error-format=checkstyle src | cs2pr
18+
phpcs:
19+
uses: michaelbaril/shared/.github/workflows/phpcs.yml@main
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: "Publish API documentation"
2+
on:
3+
push:
4+
branches: [master, main]
5+
paths:
6+
- src/**
7+
- apigen.neon
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
jobs:
12+
publish-api-doc:
13+
uses: michaelbaril/shared/.github/workflows/publish-api-doc.yml@main

.github/workflows/publish-apidoc.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 9 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
name: "Publish coverage"
22
on:
33
push:
4-
branches:
5-
- master
6-
- main
4+
branches: [master, main]
75
paths:
86
- src/**
97
- tests/**
@@ -12,65 +10,11 @@ concurrency:
1210
group: ${{ github.workflow }}-${{ github.ref }}
1311
cancel-in-progress: true
1412
jobs:
15-
generate:
16-
runs-on: ubuntu-latest
17-
steps:
18-
- name: Checkout code
19-
uses: actions/checkout@v4
20-
- name: Start MySQL
21-
run: |
22-
sudo systemctl start mysql.service
23-
mysql -uroot -proot -e 'CREATE DATABASE test'
24-
mysql -uroot -proot -e "CREATE USER 'test'@'%' IDENTIFIED WITH mysql_native_password BY 'test'"
25-
mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON test.* TO 'test'@'%'"
26-
mysql -uroot -proot -e "FLUSH PRIVILEGES"
27-
- name: Setup PHP
28-
uses: shivammathur/setup-php@v2
29-
with:
30-
php-version: 8.2
31-
extensions: curl, zip, mbstring, pdo, pdo_mysql
32-
coverage: xdebug
33-
- name: Install dependencies
34-
run: |
35-
composer update --prefer-dist --no-interaction
36-
- name: Setup .env
37-
run: |
38-
sed -i -E "s/^DB_HOST=.*$/DB_HOST=127.0.0.1/g" .env.test
39-
- name: Enable PHPUnit coverage
40-
run: |
41-
sed -i "s/<\!--<coverage/<coverage/g" phpunit.xml
42-
sed -i "s/<\/coverage>-->/<\/coverage>/g" phpunit.xml
43-
- name: Execute tests
44-
run: vendor/bin/phpunit
45-
- name: Make code coverage badge
46-
uses: steffendietz/[email protected]
47-
with:
48-
path-to-clover: clover.xml
49-
path-to-json: coverage/badge.json
50-
- name: Round percentage
51-
run: |
52-
percentage=$(sed -E "s/^.*\"([0-9.]+)\%.*$/\1/g" coverage/badge.json)
53-
rounded=$(php -r "echo round($percentage);")
54-
sed -i "s/$percentage%/$rounded%/g" coverage/badge.json
55-
- name: Upload artifact
56-
uses: actions/upload-artifact@v4
57-
with:
58-
name: coverage
59-
path: coverage
60-
publish:
61-
needs: generate
62-
runs-on: ubuntu-latest
63-
concurrency:
64-
group: publish-gh-pages
65-
steps:
66-
- name: Download artifact
67-
uses: actions/download-artifact@v4
68-
- name: Publish coverage
69-
uses: peaceiris/actions-gh-pages@v3
70-
with:
71-
github_token: ${{ secrets.GITHUB_TOKEN }}
72-
publish_dir: ./coverage
73-
destination_dir: coverage
74-
user_name: 'github-actions[bot]'
75-
user_email: 'github-actions[bot]@users.noreply.github.com'
76-
commit_message: Update coverage
13+
generate-coverage:
14+
name: "Generate coverage"
15+
uses: michaelbaril/shared/.github/workflows/run-tests.yml@main
16+
with:
17+
with-coverage: true
18+
publish-coverage:
19+
needs: generate-coverage
20+
uses: michaelbaril/shared/.github/workflows/publish-coverage.yml@main

.github/workflows/publish-doc.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "Publish documentation"
2+
on:
3+
push:
4+
branches: [master, main]
5+
paths:
6+
- README.md
7+
- doc/**.md
8+
- markdown-to-html.json
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
jobs:
13+
publish-doc:
14+
uses: michaelbaril/shared/.github/workflows/publish-doc.yml@main
15+

.github/workflows/publish-readme.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)