Skip to content

Use MySQL service

Use MySQL service #8

Workflow file for this run

name: Code Analysis
on:
pull_request: null
push:
branches:
- develop
- v5
workflow_dispatch:
permissions:
contents: read
jobs:
code_analysis:
strategy:
fail-fast: false
matrix:
actions:
- name: 'Pest Tests'
run: composer pest
- name: 'PHPStan'
run: composer phpstan
- name: 'Coding Standards'
run: composer fix-cs
name: ${{ matrix.actions.name }}
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: password
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
env:
CRAFT_DB_DRIVER: mysql
CRAFT_DB_SERVER: 127.0.0.1
CRAFT_DB_PORT: 3306
CRAFT_DB_DATABASE: db
CRAFT_DB_USER: root
CRAFT_DB_PASSWORD: password
steps:
- uses: actions/checkout@v4
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- name: Setup PHP
id: setup-php
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: 'ctype,curl,dom,iconv,imagick,intl,json,mbstring,openssl,pcre,pdo,reflection,spl,zip'
ini-values: post_max_size=256M, max_execution_time=180, memory_limit=512M
tools: composer:v2
- name: Install Composer dependencies
run: composer install --no-interaction --no-ansi --no-progress
- name: Create MySQL database
run: |
mysql -e 'CREATE DATABASE IF NOT EXISTS db;'Z
- run: ${{ matrix.actions.run }}