Skip to content

Commit 7b07d3b

Browse files
committed
github actions added
1 parent bd0ef71 commit 7b07d3b

2 files changed

Lines changed: 69 additions & 23 deletions

File tree

.github/workflows/tests.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '0 0 * * *'
8+
9+
jobs:
10+
tests:
11+
runs-on: ubuntu-latest
12+
13+
services:
14+
postgres:
15+
image: postgres:12
16+
env:
17+
POSTGRES_USER: postgres
18+
POSTGRES_PASSWORD: password
19+
ports:
20+
- 5432:5432
21+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
22+
23+
strategy:
24+
fail-fast: true
25+
matrix:
26+
#php: [8.0, 8.1]
27+
php: [8.1]
28+
29+
name: PHP ${{ matrix.php }}
30+
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v2
34+
35+
- name: Install PHP
36+
uses: shivammathur/setup-php@v2
37+
with:
38+
php-version: ${{ matrix.php }}
39+
tools: composer:v2
40+
coverage: xdebug
41+
42+
- name: Install dependencies
43+
run: composer install
44+
45+
- name: Load Postgres database
46+
run: PGPASSWORD=password psql -U postgres -h0.0.0.0 -a -f vendor/linna/db-dumps/src/linna_db_pgsql.sql
47+
48+
- name: Execute tests
49+
run: vendor/bin/phpunit -c phpunit.xml --verbose

phpunit.xml

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.0/phpunit.xsd"
4-
colors="true"
5-
bootstrap="vendor/autoload.php"
6-
verbose="true">
7-
<testsuites>
8-
<testsuite name="Linna Test Suite">
9-
<directory suffix="Test.php">tests</directory>
10-
</testsuite>
11-
</testsuites>
12-
<filter>
13-
<whitelist>
14-
<directory suffix=".php">src</directory>
15-
</whitelist>
16-
</filter>
17-
<logging>
18-
<log type="coverage-clover" target="clover.xml"/>
19-
</logging>
20-
<php>
21-
<var name="pdo_pgsql_dsn" value="pgsql:host=localhost;dbname=linna_db"/>
22-
<var name="pdo_pgsql_user" value="postgres" />
23-
<var name="pdo_pgsql_password" value="" />
24-
</php>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" colors="true" bootstrap="vendor/autoload.php" verbose="true">
3+
<coverage>
4+
<include>
5+
<directory suffix=".php">src</directory>
6+
</include>
7+
<report>
8+
<clover outputFile="clover.xml"/>
9+
</report>
10+
</coverage>
11+
<testsuites>
12+
<testsuite name="Linna Test Suite">
13+
<directory suffix="Test.php">tests</directory>
14+
</testsuite>
15+
</testsuites>
16+
<logging/>
17+
<php>
18+
<var name="pdo_pgsql_dsn" value="pgsql:host=0.0.0.0;dbname=linna_db"/>
19+
<var name="pdo_pgsql_user" value="postgres"/>
20+
<var name="pdo_pgsql_password" value="password"/>
21+
</php>
2522
</phpunit>

0 commit comments

Comments
 (0)