base it off of xorm gitea action mysql8 test
This commit is contained in:
parent
bfa8f8c9fd
commit
003f5d17f1
|
@ -21,33 +21,28 @@ jobs:
|
||||||
prefer-lowest: 'prefer-lowest'
|
prefer-lowest: 'prefer-lowest'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
mysql8:
|
||||||
|
image: mysql:8.0
|
||||||
|
env:
|
||||||
|
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
||||||
|
MYSQL_DATABASE: cakephp
|
||||||
|
# services:
|
||||||
# postgres:
|
# postgres:
|
||||||
# image: postgres
|
# image: postgres
|
||||||
# ports:
|
# ports:
|
||||||
# - 5432:5432
|
# - 5432:5432
|
||||||
# env:
|
# env:
|
||||||
# POSTGRES_PASSWORD: postgres
|
# POSTGRES_PASSWORD: postgres
|
||||||
mysql8:
|
# mysql8:
|
||||||
image: mysql:8.0
|
# image: mysql:8.0
|
||||||
env:
|
# env:
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
# MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
||||||
MYSQL_DATABASE: test_db
|
# MYSQL_DATABASE: test_db
|
||||||
ports:
|
# ports:
|
||||||
- 3306:3306
|
# - 3306:3306
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Setup Service
|
|
||||||
if: matrix.db-type == 'mysql'
|
|
||||||
run: |
|
|
||||||
apt-get update && apt-get install -y lsb-release inetutils-tools
|
|
||||||
wget https://dev.mysql.com/get/mysql-apt-config_0.8.24-1_all.deb
|
|
||||||
DEBIAN_FRONTEND=noninteractive dpkg -i mysql-apt-config_0.8.24-1_all.deb
|
|
||||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B7B3B788A8D3785C
|
|
||||||
apt-get update
|
|
||||||
apt install -y default-mysql-client
|
|
||||||
mysql -h mysql8 -u root -e 'CREATE DATABASE cakephp;'
|
|
||||||
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
|
@ -80,15 +75,15 @@ jobs:
|
||||||
if: matrix.db-type == 'mysql'
|
if: matrix.db-type == 'mysql'
|
||||||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
|
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
|
||||||
|
|
||||||
- name: Wait for MySQL
|
|
||||||
if: matrix.db-type == 'mysql'
|
|
||||||
run: while ! `mysqladmin ping -h mysql8 --silent`; do printf 'Waiting for MySQL...\n'; sleep 2; done;
|
|
||||||
|
|
||||||
- name: Run PHPUnit
|
- name: Run PHPUnit tests
|
||||||
|
env:
|
||||||
|
TEST_MYSQL_HOST: mysql8
|
||||||
|
TEST_MYSQL_CHARSET: utf8mb4
|
||||||
|
TEST_MYSQL_DBNAME: cakephp
|
||||||
|
TEST_MYSQL_USERNAME: root
|
||||||
|
TEST_MYSQL_PASSWORD:
|
||||||
run: |
|
run: |
|
||||||
if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DB_URL='sqlite:///:memory:'; fi
|
|
||||||
if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export DB_URL='mysql://root:root@mysql8/cakephp?encoding=utf8'; fi
|
|
||||||
if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DB_URL='postgres://postgres:postgres@127.0.0.1/postgres'; fi
|
|
||||||
if [[ ${{ matrix.php-version }} == '8.1' ]]; then
|
if [[ ${{ matrix.php-version }} == '8.1' ]]; then
|
||||||
vendor/bin/phpunit --coverage-clover=coverage.xml
|
vendor/bin/phpunit --coverage-clover=coverage.xml
|
||||||
else
|
else
|
||||||
|
@ -111,7 +106,6 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
|
|
Loading…
Reference in New Issue