Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Nov 30, 2024
1 parent ed810d3 commit e4570fe
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 10 deletions.
26 changes: 16 additions & 10 deletions .github/workflows/REUSABLE_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ env:
FLARUM_TEST_TMP_DIR_LOCAL: tests/integration/tmp
COMPOSER_AUTH: ${{ secrets.composer_auth }}
DB_DATABASE: flarum_test
DB_USERNAME: root
DB_PASSWORD: root
DB_USERNAME: flarum
DB_PASSWORD: password

jobs:
test:
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
- php: ${{ fromJSON(inputs.php_versions)[0] }}
service: mariadb
db: MariaDB
driver: mysql
driver: mariadb
prefix: flarum_
prefixStr: (prefix)
- php: ${{ fromJSON(inputs.php_versions)[0] }}
Expand Down Expand Up @@ -154,14 +154,15 @@ jobs:

services:
mysql:
image: ${{ matrix.driver == 'mysql' && matrix.service || '' }}
image: ${{ (matrix.driver == 'mysql' && matrix.service) || ((matrix.driver == 'mariadb' && matrix.service) || '') }}
env:
MYSQL_DATABASE: ${{ env.DB_DATABASE }}
MYSQL_USER: ${{ env.DB_USERNAME }}
MYSQL_PASSWORD: ${{ env.DB_PASSWORD }}
MYSQL_ROOT_PASSWORD: ${{ env.DB_PASSWORD }}
MYSQL_ROOT_PASSWORD: root
ports:
- 13306:3306
- 33306:33306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10
postgres:
image: ${{ matrix.driver == 'pgsql' && matrix.service || '' }}
env:
Expand Down Expand Up @@ -194,11 +195,16 @@ jobs:
tools: phpunit, composer:v2
ini-values: ${{ matrix.php_ini_values }}

- name: Create MySQL Database
if: ${{ matrix.driver == 'mysql' }}
- name: mysql version
if: ${{ matrix.driver == 'mysql' || matrix.driver == 'mariadb' }}
run: |
mysql -h 127.0.0.1 --port 33306 -uroot -proot -e "SELECT @@VERSION"
- name: Create ${{ matrix.db }} Database
if: ${{ matrix.driver == 'mysql' || matrix.driver == 'mariadb' }}
run: |
sudo systemctl start mysql
mysql -uroot -proot -e 'CREATE DATABASE flarum_test;' --port 13306
mysql -uroot -proot -e 'CREATE DATABASE flarum_test;' --port 33306
- name: Install Composer dependencies
run: composer install
Expand All @@ -222,7 +228,7 @@ jobs:
fi
working-directory: ${{ inputs.backend_directory }}
env:
DB_PORT: ${{ matrix.driver == 'mysql' && 13306 || 15432 }}
DB_PORT: ${{ matrix.driver == 'mysql' && 33306 || (matrix.driver == 'mariadb' && 33306 || 15432) }}
DB_PREFIX: ${{ matrix.prefix }}
DB_DRIVER: ${{ matrix.driver }}
COMPOSER_PROCESS_TIMEOUT: 600
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Service_test
on:
workflow_dispatch:

jobs:
test_runner:
name: CI
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: password
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: mysql version
run: mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uroot -ppassword -e "SELECT @@VERSION"

0 comments on commit e4570fe

Please sign in to comment.