From cab8cce3aa6df58c941f4570c4384f7a63bc8b20 Mon Sep 17 00:00:00 2001 From: Jeffrey Wong Date: Tue, 1 Nov 2022 14:53:36 -0700 Subject: [PATCH 1/7] add github action workflow --- .github/workflows/test.yml | 75 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..d58607266 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,75 @@ +name: test + +on: + push: + +jobs: + test: + env: + DB=mysql + DB_USER=root + runs-on: ubuntu-18.04 + strategy: + fail-fast: false + matrix: + php: + - '7.3' + - '7.4' + - '8.0' + - '8.1' + composer: + - '' + - '--prefer-lowest' + + steps: + - uses: actions/checkout@v2 + + - name: Use PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: sqlite3, zip + coverage: xdebug + tools: composer:v1 + + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-dir)" + working-directory: ./ + + - name: cache dependencies + id: cache-dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.composer }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.php }}-${{ matrix.composer }}-composer- + + - name: Validate composer.json and composer.lock + run: composer validate + working-directory: ./ + + - name: Install dependencies + env: + COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} + COMPOSER_FLAGS: ${{ matrix.composer }} + run: composer install ${COMPOSER_FLAGS} --prefer-source + working-directory: ./ + + - name: Start MySQL + run: | + sudo systemctl start mysql + mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -proot mysql + + - name: setup database + run: | + sh -c "if [ '$DB' = 'mysql' ]; then 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" + sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE test; CREATE SCHEMA bookstore_schemas; CREATE SCHEMA contest; CREATE SCHEMA second_hand_books; CREATE DATABASE reverse_bookstore;'; fi" + ./test/reset_tests.sh + working-directory: ./ + + - name: Run Tests + run: vendor/bin/phpunit + working-directory: ./ From 635e1a3a680447f17a839e24afb131ed53346672 Mon Sep 17 00:00:00 2001 From: Jeffrey Wong Date: Tue, 1 Nov 2022 14:58:42 -0700 Subject: [PATCH 2/7] fix env syntax --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d58607266..596cbb39c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,8 +6,8 @@ on: jobs: test: env: - DB=mysql - DB_USER=root + DB: mysql + DB_USER: root runs-on: ubuntu-18.04 strategy: fail-fast: false From 5af9a0a3faf2c7fae9929cb65aa7e5e6b76663ed Mon Sep 17 00:00:00 2001 From: Jeffrey Wong Date: Tue, 1 Nov 2022 15:05:04 -0700 Subject: [PATCH 3/7] switch back to composer update to fix "--prefer-lowest" --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 596cbb39c..629a76f25 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,7 +55,7 @@ jobs: env: COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} COMPOSER_FLAGS: ${{ matrix.composer }} - run: composer install ${COMPOSER_FLAGS} --prefer-source + run: composer update ${COMPOSER_FLAGS} --prefer-source working-directory: ./ - name: Start MySQL From 9c3a084d343f748f377cfdef4bc2243406e61b47 Mon Sep 17 00:00:00 2001 From: Jeffrey Wong Date: Tue, 1 Nov 2022 15:11:45 -0700 Subject: [PATCH 4/7] set mysql user/pass on CLI --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 629a76f25..9f1eec087 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -65,8 +65,8 @@ jobs: - name: setup database run: | - sh -c "if [ '$DB' = 'mysql' ]; then 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" - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE test; CREATE SCHEMA bookstore_schemas; CREATE SCHEMA contest; CREATE SCHEMA second_hand_books; CREATE DATABASE reverse_bookstore;'; fi" + 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" + 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" ./test/reset_tests.sh working-directory: ./ From f26104d7757b575b6310cbc6718f2009d1398d67 Mon Sep 17 00:00:00 2001 From: Jeffrey Wong Date: Tue, 1 Nov 2022 15:19:51 -0700 Subject: [PATCH 5/7] set mysql password in fixtures --- test/fixtures/bookstore/build.properties | 2 +- test/fixtures/bookstore/runtime-conf.xml | 6 +++--- test/fixtures/namespaced/build.properties | 2 +- test/fixtures/namespaced/runtime-conf.xml | 2 +- test/fixtures/nestedset/runtime-conf.xml | 2 +- test/fixtures/reverse/mysql/build.properties | 2 +- test/fixtures/reverse/mysql/runtime-conf.xml | 2 +- test/fixtures/reverse/pgsql/runtime-conf.xml | 2 +- test/fixtures/schemas/runtime-conf.xml | 2 +- test/fixtures/treetest/runtime-conf.xml | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/fixtures/bookstore/build.properties b/test/fixtures/bookstore/build.properties index 23b1d04c2..681bb7540 100644 --- a/test/fixtures/bookstore/build.properties +++ b/test/fixtures/bookstore/build.properties @@ -19,7 +19,7 @@ propel.schema.autoPrefix = true # For MySQL or Oracle, you also need to specify username & password propel.database.user = root -#propel.database.password = [db password] +propel.database.password = root # Note that if you do not wish to specify the database (e.g. if you # are using multiple databases) you can use the @DB@ token which diff --git a/test/fixtures/bookstore/runtime-conf.xml b/test/fixtures/bookstore/runtime-conf.xml index f3fa856a8..da5f43269 100644 --- a/test/fixtures/bookstore/runtime-conf.xml +++ b/test/fixtures/bookstore/runtime-conf.xml @@ -21,7 +21,7 @@ For MySQL and Oracle you must specify username + password separate from DSN: --> root - + root @@ -56,7 +56,7 @@ For MySQL and Oracle you must specify username + password separate from DSN: --> root - + root @@ -78,7 +78,7 @@ For MySQL and Oracle you must specify username + password separate from DSN: --> root - + root diff --git a/test/fixtures/namespaced/build.properties b/test/fixtures/namespaced/build.properties index de605d4ad..b3426f6d7 100644 --- a/test/fixtures/namespaced/build.properties +++ b/test/fixtures/namespaced/build.properties @@ -18,7 +18,7 @@ propel.disableIdentifierQuoting=true # For MySQL or Oracle, you also need to specify username & password propel.database.user = root -#propel.database.password = [db password] +propel.database.password = root # Note that if you do not wish to specify the database (e.g. if you # are using multiple databases) you can use the @DB@ token which diff --git a/test/fixtures/namespaced/runtime-conf.xml b/test/fixtures/namespaced/runtime-conf.xml index 2c351913e..d99174c89 100644 --- a/test/fixtures/namespaced/runtime-conf.xml +++ b/test/fixtures/namespaced/runtime-conf.xml @@ -21,7 +21,7 @@ For MySQL and Oracle you must specify username + password separate from DSN: --> root - + root diff --git a/test/fixtures/nestedset/runtime-conf.xml b/test/fixtures/nestedset/runtime-conf.xml index 5ec3bbce1..802c76043 100644 --- a/test/fixtures/nestedset/runtime-conf.xml +++ b/test/fixtures/nestedset/runtime-conf.xml @@ -45,7 +45,7 @@ sqlite sqlite:/var/tmp/nestedset.db - + root diff --git a/test/fixtures/reverse/mysql/build.properties b/test/fixtures/reverse/mysql/build.properties index 05aaad78a..57db39b7c 100644 --- a/test/fixtures/reverse/mysql/build.properties +++ b/test/fixtures/reverse/mysql/build.properties @@ -17,7 +17,7 @@ propel.database.url = mysql:dbname=reverse_bookstore # For MySQL or Oracle, you also need to specify username & password propel.database.user = root -#propel.database.password = [db password] +propel.database.password = root propel.mysql.tableType = InnoDB diff --git a/test/fixtures/reverse/mysql/runtime-conf.xml b/test/fixtures/reverse/mysql/runtime-conf.xml index c328761a3..39a8d0dea 100644 --- a/test/fixtures/reverse/mysql/runtime-conf.xml +++ b/test/fixtures/reverse/mysql/runtime-conf.xml @@ -19,7 +19,7 @@ For MySQL and Oracle you must specify username + password separate from DSN: --> root - + root diff --git a/test/fixtures/reverse/pgsql/runtime-conf.xml b/test/fixtures/reverse/pgsql/runtime-conf.xml index d060ce54a..aee1ab4c4 100644 --- a/test/fixtures/reverse/pgsql/runtime-conf.xml +++ b/test/fixtures/reverse/pgsql/runtime-conf.xml @@ -18,7 +18,7 @@ diff --git a/test/fixtures/schemas/runtime-conf.xml b/test/fixtures/schemas/runtime-conf.xml index 76f894101..fc6f5d58f 100644 --- a/test/fixtures/schemas/runtime-conf.xml +++ b/test/fixtures/schemas/runtime-conf.xml @@ -19,7 +19,7 @@ For MySQL and Oracle you must specify username + password separate from DSN: --> root - + root diff --git a/test/fixtures/treetest/runtime-conf.xml b/test/fixtures/treetest/runtime-conf.xml index 0996495e0..274bd1c1c 100644 --- a/test/fixtures/treetest/runtime-conf.xml +++ b/test/fixtures/treetest/runtime-conf.xml @@ -45,7 +45,7 @@ sqlite sqlite:/var/tmp/treetest.db - + root From e4bdc04f19c8f1790d1dee4b7402adb139f94583 Mon Sep 17 00:00:00 2001 From: Jeffrey Wong Date: Tue, 1 Nov 2022 15:25:18 -0700 Subject: [PATCH 6/7] use older versions of php to confirm tests work --- .github/workflows/test.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9f1eec087..4a50c7f52 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,10 +13,12 @@ jobs: fail-fast: false matrix: php: + - '5.6' + - '7.2' - '7.3' - '7.4' - - '8.0' - - '8.1' +# - '8.0' +# - '8.1' composer: - '' - '--prefer-lowest' @@ -63,6 +65,10 @@ jobs: sudo systemctl start mysql mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -proot mysql + - name: Disable MySQL strict mode + run: | + echo "SET GLOBAL sql_mode = ''" | mysql -u root -proot mysql + - name: setup database run: | 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" From 8b5adb938a395261a193903fe1c146253cd170ff Mon Sep 17 00:00:00 2001 From: Jeffrey Wong Date: Tue, 1 Nov 2022 15:35:52 -0700 Subject: [PATCH 7/7] set one more password --- test/fixtures/schemas/build.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/test/fixtures/schemas/build.properties b/test/fixtures/schemas/build.properties index 545840036..46ba085ef 100644 --- a/test/fixtures/schemas/build.properties +++ b/test/fixtures/schemas/build.properties @@ -14,6 +14,7 @@ propel.project = bookstore propel.database = mysql propel.database.url = mysql:dbname=test propel.database.user = root +propel.database.password = root propel.mysql.tableType = InnoDB propel.disableIdentifierQuoting = true propel.schema.autoPrefix = true