Skip to content

Commit 9e51344

Browse files
s3b4stianSebastian Rapetti
authored andcommitted
gitea-workflow (#1)
Reviewed-on: https://gitea.int.s.rapetti.dev/Linna/framework/pulls/1 Co-authored-by: Sebastian Rapetti <sebastian.rapetti@tim.it> Co-committed-by: Sebastian Rapetti <sebastian.rapetti@tim.it>
1 parent ef73bc0 commit 9e51344

2 files changed

Lines changed: 55 additions & 16 deletions

File tree

.gitea/workflows/tests.yml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,32 @@ jobs:
1313
image: mysql:9
1414
env:
1515
MYSQL_ROOT_PASSWORD: password
16-
ports:
17-
- 3306:3306
16+
expose:
17+
- 3306
1818
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10
1919
postgres:
2020
image: postgres:17
2121
env:
2222
POSTGRES_USER: postgres
2323
POSTGRES_PASSWORD: password
24-
ports:
25-
- 5432:5432
24+
expose:
25+
- 5432
2626
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
2727
mongodb:
2828
image: mongo
2929
env:
3030
MONGO_INITDB_ROOT_USERNAME: root
3131
MONGO_INITDB_ROOT_PASSWORD: password
32-
ports:
33-
- 27017:27017
32+
expose:
33+
- 27017
3434
memcached:
3535
image: memcached
36-
ports:
37-
- 11211:11211
36+
expose:
37+
- 11211
3838
redis:
3939
image: redis
40-
ports:
41-
- 6379:6379
40+
expose:
41+
- 6379
4242
options: --entrypoint redis-server
4343

4444
strategy:
@@ -65,21 +65,25 @@ jobs:
6565
run: |
6666
cp composer.$(echo ${{ matrix.mapper }} ).json composer.json
6767
68-
- name: Install Mysql Client
69-
run: apt-get update && apt-get install mysql-client
68+
- name: Install DB Client
69+
run: apt-get update && apt-get install mysql-client postgresql-client-16 -y
7070

7171
- name: Install dependencies
7272
run: composer install
7373

7474
- name: Load Mysql database
7575
run: |
76-
mysql -uroot -h0.0.0.0 -ppassword < vendor/linna/db-dumps/src/linna_db_mysql_test.sql
77-
mysql -uroot -h0.0.0.0 -ppassword -e "SELECT user_id,name from linna_db.user"
76+
mysql -uroot -hmysql -ppassword < vendor/linna/db-dumps/src/linna_db_mysql_test.sql
77+
mysql -uroot -hmysql -ppassword -e "SELECT user_id,name from linna_db.user"
7878
7979
- name: Load Postgres database
8080
run: |
81-
PGPASSWORD=password psql -U postgres -h0.0.0.0 -a -f vendor/linna/db-dumps/src/linna_db_pgsql_test.sql
82-
PGPASSWORD=password psql -U postgres -h0.0.0.0 -d linna_db -c "SELECT user_id, name from public.user"
81+
PGPASSWORD=password psql -U postgres -hpostgres -a -f vendor/linna/db-dumps/src/linna_db_pgsql_test.sql
82+
PGPASSWORD=password psql -U postgres -hpostgres -d linna_db -c "SELECT user_id, name from public.user"
83+
84+
- name: Override phpunit conf
85+
run: |
86+
mv phpunit.gitea.xml phpunit.xml
8387
8488
- name: Execute tests
8589
run: vendor/bin/phpunit

phpunit.gitea.xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd" colors="true" bootstrap="vendor/autoload.php" cacheDirectory=".phpunit.cache">
3+
<coverage>
4+
<report>
5+
<clover outputFile="clover.xml"/>
6+
</report>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="Linna Test Suite">
10+
<directory suffix="Test.php">tests</directory>
11+
</testsuite>
12+
</testsuites>
13+
<logging/>
14+
<php>
15+
<var name="pdo_mysql_dsn" value="mysql:host=mysql;dbname=linna_db;charset=utf8mb4"/>
16+
<var name="pdo_mysql_host" value="mysql"/>
17+
<var name="pdo_mysql_user" value="root"/>
18+
<var name="pdo_mysql_password" value="password"/>
19+
<var name="pdo_pgsql_dsn" value="pgsql:dbname=linna_db;host=postgres"/>
20+
<var name="pdo_pgsql_user" value="postgres"/>
21+
<var name="pdo_pgsql_password" value="password"/>
22+
<var name="pgsql_connection_string" value="host=postgres port=5432 dbname=linna_db user=postgres password=password"/>
23+
<var name="mem_host" value="memcached"/>
24+
<var name="mem_port" value="11211"/>
25+
<var name="mongodb_server_string" value="mongodb://mongodb:27017"/>
26+
<var name="redis_host" value="redis"/>
27+
<var name="redis_port" value="6379"/>
28+
<var name="redis_password" value=""/>
29+
</php>
30+
<source>
31+
<include>
32+
<directory suffix=".php">src</directory>
33+
</include>
34+
</source>
35+
</phpunit>

0 commit comments

Comments
 (0)