Skip to content

Commit

Permalink
Add mysql to tests
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>
  • Loading branch information
sampoyigi committed Jan 20, 2024
1 parent 8e9e40b commit 240c828
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,24 @@ jobs:
matrix:
os: [ ubuntu-latest ]
php: [ 8.2, 8.3 ]
env:
DB_DATABASE: testbench
DB_USERNAME: root
DB_PASSWORD: root

name: PHP ${{ matrix.php }} - ${{ matrix.os }}

services:
mysql:
image: 'mysql:8.0'
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: testbench
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -23,10 +38,16 @@ jobs:
extensions: dom, curl, xml, mbstring, zip, pdo, sqlite, bcmath, soap, intl, gd
coverage: none

- name: Create MySQL Database
run: |
sudo systemctl start mysql
mysql -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' --port ${{ job.services.mysql.ports['3306'] }}
- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: composer update --prefer-stable --prefer-dist --no-interaction

Expand Down

0 comments on commit 240c828

Please sign in to comment.