Skip to content

Commit 678736a

Browse files
jwong-dayspringDanielFortuyn
authored andcommitted
add github actions test workflow (propelorm#2)
* add github action workflow * fix env syntax * switch back to composer update to fix "--prefer-lowest" * set mysql user/pass on CLI * set mysql password in fixtures * use older versions of php to confirm tests work * set one more password Co-authored-by: Jeffrey Wong <jwong@dayspringpartners.com>
1 parent 19326d4 commit 678736a

File tree

12 files changed

+94
-12
lines changed

12 files changed

+94
-12
lines changed

.github/workflows/test.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: test
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
test:
8+
env:
9+
DB: mysql
10+
DB_USER: root
11+
runs-on: ubuntu-18.04
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
php:
16+
- '5.6'
17+
- '7.2'
18+
- '7.3'
19+
- '7.4'
20+
# - '8.0'
21+
# - '8.1'
22+
composer:
23+
- ''
24+
- '--prefer-lowest'
25+
26+
steps:
27+
- uses: actions/checkout@v2
28+
29+
- name: Use PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: ${{ matrix.php }}
33+
extensions: sqlite3, zip
34+
coverage: xdebug
35+
tools: composer:v1
36+
37+
- name: Get Composer Cache Directory
38+
id: composer-cache
39+
run: |
40+
echo "::set-output name=dir::$(composer config cache-dir)"
41+
working-directory: ./
42+
43+
- name: cache dependencies
44+
id: cache-dependencies
45+
uses: actions/cache@v1
46+
with:
47+
path: ${{ steps.composer-cache.outputs.dir }}
48+
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.composer }}-composer-${{ hashFiles('**/composer.lock') }}
49+
restore-keys: |
50+
${{ runner.os }}-${{ matrix.php }}-${{ matrix.composer }}-composer-
51+
52+
- name: Validate composer.json and composer.lock
53+
run: composer validate
54+
working-directory: ./
55+
56+
- name: Install dependencies
57+
env:
58+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
59+
COMPOSER_FLAGS: ${{ matrix.composer }}
60+
run: composer update ${COMPOSER_FLAGS} --prefer-source
61+
working-directory: ./
62+
63+
- name: Start MySQL
64+
run: |
65+
sudo systemctl start mysql
66+
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -proot mysql
67+
68+
- name: Disable MySQL strict mode
69+
run: |
70+
echo "SET GLOBAL sql_mode = ''" | mysql -u root -proot mysql
71+
72+
- name: setup database
73+
run: |
74+
sh -c "if [ '$DB' = 'mysql' ]; then mysql -u root -proot mysql -e 'SET FOREIGN_KEY_CHECKS = 0; DROP DATABASE IF EXISTS test; DROP SCHEMA IF EXISTS second_hand_books; DROP SCHEMA IF EXISTS contest; DROP DATABASE IF EXISTS reverse_bookstore; DROP SCHEMA IF EXISTS bookstore_schemas; SET FOREIGN_KEY_CHECKS = 1;'; fi"
75+
sh -c "if [ '$DB' = 'mysql' ]; then mysql -u root -proot mysql -e 'CREATE DATABASE test; CREATE SCHEMA bookstore_schemas; CREATE SCHEMA contest; CREATE SCHEMA second_hand_books; CREATE DATABASE reverse_bookstore;'; fi"
76+
./test/reset_tests.sh
77+
working-directory: ./
78+
79+
- name: Run Tests
80+
run: vendor/bin/phpunit
81+
working-directory: ./

test/fixtures/bookstore/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ propel.schema.autoPrefix = true
1919

2020
# For MySQL or Oracle, you also need to specify username & password
2121
propel.database.user = root
22-
#propel.database.password = [db password]
22+
propel.database.password = root
2323

2424
# Note that if you do not wish to specify the database (e.g. if you
2525
# are using multiple databases) you can use the @DB@ token which

test/fixtures/bookstore/runtime-conf.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
For MySQL and Oracle you must specify username + password separate from DSN:
2222
-->
2323
<user>root</user>
24-
<password></password>
24+
<password>root</password>
2525
<options>
2626
<option id="ATTR_PERSISTENT">false</option>
2727
</options>
@@ -56,7 +56,7 @@
5656
For MySQL and Oracle you must specify username + password separate from DSN:
5757
-->
5858
<user>root</user>
59-
<password></password>
59+
<password>root</password>
6060
<options>
6161
<option id="ATTR_PERSISTENT">false</option>
6262
</options>
@@ -78,7 +78,7 @@
7878
For MySQL and Oracle you must specify username + password separate from DSN:
7979
-->
8080
<user>root</user>
81-
<password></password>
81+
<password>root</password>
8282
<options>
8383
<option id="ATTR_PERSISTENT">false</option>
8484
</options>

test/fixtures/namespaced/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ propel.disableIdentifierQuoting=true
1818

1919
# For MySQL or Oracle, you also need to specify username & password
2020
propel.database.user = root
21-
#propel.database.password = [db password]
21+
propel.database.password = root
2222

2323
# Note that if you do not wish to specify the database (e.g. if you
2424
# are using multiple databases) you can use the @DB@ token which

test/fixtures/namespaced/runtime-conf.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
For MySQL and Oracle you must specify username + password separate from DSN:
2222
-->
2323
<user>root</user>
24-
<password></password>
24+
<password>root</password>
2525
<options>
2626
<option id="ATTR_PERSISTENT">false</option>
2727
</options>

test/fixtures/nestedset/runtime-conf.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<phptype>sqlite</phptype>
4646
<dsn>sqlite:/var/tmp/nestedset.db</dsn>
4747
<username></username>
48-
<password></password>
48+
<password>root</password>
4949
</connection>
5050
</datasource>
5151
</datasources>

test/fixtures/reverse/mysql/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ propel.database.url = mysql:host=db;dbname=reverse_bookstore
1717

1818
# For MySQL or Oracle, you also need to specify username & password
1919
propel.database.user = root
20-
#propel.database.password = [db password]
20+
propel.database.password = root
2121

2222
propel.mysql.tableType = InnoDB
2323

test/fixtures/reverse/mysql/runtime-conf.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
For MySQL and Oracle you must specify username + password separate from DSN:
2020
-->
2121
<user>root</user>
22-
<password></password>
22+
<password>root</password>
2323
<options>
2424
<option id="ATTR_PERSISTENT">false</option>
2525
</options>

test/fixtures/reverse/pgsql/runtime-conf.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<!--
1919
For MySQL and Oracle you must specify username + password separate from DSN:
2020
<user>bookstore</user>
21-
<password></password>
21+
<password>root</password>
2222
-->
2323
<options>
2424
<option id="ATTR_PERSISTENT">false</option>

test/fixtures/schemas/build.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ propel.project = bookstore
1414
propel.database = mysql
1515
propel.database.url = mysql:host=db;dbname=test
1616
propel.database.user = root
17+
propel.database.password = root
1718
propel.mysql.tableType = InnoDB
1819
propel.disableIdentifierQuoting = true
1920
propel.schema.autoPrefix = true

0 commit comments

Comments
 (0)