Skip to content

Commit 8899f4f

Browse files
committed
test workflow
1 parent 5c7dcdc commit 8899f4f

File tree

2 files changed

+106
-14
lines changed

2 files changed

+106
-14
lines changed

.github/workflows/symfony.yml

+25-14
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,23 @@ permissions:
1717
jobs:
1818
symfony-tests:
1919
runs-on: ubuntu-latest
20+
services:
21+
mariadb:
22+
image: mariadb:latest
23+
ports:
24+
- 3307:3307
25+
options: >-
26+
--health-cmd="mysqladmin ping --silent"
27+
--health-interval=10s
28+
--health-timeout=5s
29+
--health-retries=3
30+
env:
31+
MYSQL_ROOT_PASSWORD: root
32+
MYSQL_DATABASE: fphp8
33+
MYSQL_USER: test_user
34+
MYSQL_PASSWORD: test_password
35+
2036
steps:
21-
# To automatically get bug fixes and new Php versions for shivammathur/setup-php,
22-
# change this to (see https://github.com/shivammathur/setup-php#bookmark-versioning):
23-
# uses: shivammathur/setup-php@v2
24-
- uses: shivammathur/setup-php@2cb9b829437ee246e9b3cac53555a39208ca6d28
25-
with:
26-
php-version: '8.2'
2737
- uses: actions/checkout@v4
2838
- name: Copy .env.test.local
2939
run: php -r "file_exists('.env.test.local') || copy('.env.test', '.env.test.local');"
@@ -37,11 +47,12 @@ jobs:
3747
${{ runner.os }}-php-
3848
- name: Install Dependencies
3949
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
40-
- name: Create Database
41-
run: |
42-
mkdir -p data
43-
touch data/database.sqlite
44-
- name: Execute tests (Unit and Feature tests) via PHPUnit
45-
env:
46-
DATABASE_URL: sqlite:///%kernel.project_dir%/data/database.sqlite
47-
run: vendor/bin/phpunit
50+
- name: Wait for MariaDB
51+
run: until mysqladmin ping -h"127.0.0.1" --silent; do echo 'waiting for mariadb...'; sleep 5; done
52+
- name: Create Database and Tables
53+
run: |
54+
mysql -u test_user -ptest_password -h 127.0.0.1 fphp8 < path/to/your/schema.sql
55+
- name: Execute tests (Unit and Feature tests) via PHPUnit
56+
env:
57+
DATABASE_URL: mysql://test_user:[email protected]:3306/fphp8
58+
run: vendor/bin/phpunit

datas/fphp8.sql

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
-- phpMyAdmin SQL Dump
2+
-- version 5.2.1
3+
-- https://www.phpmyadmin.net/
4+
--
5+
-- Hôte : 127.0.0.1:3307
6+
-- Généré le : mar. 14 jan. 2025 à 11:15
7+
-- Version du serveur : 11.5.2-MariaDB
8+
-- Version de PHP : 8.3.14
9+
10+
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11+
START TRANSACTION;
12+
SET time_zone = "+00:00";
13+
14+
--
15+
-- Base de données : `fphp8`
16+
--
17+
DROP DATABASE IF EXISTS `fphp8`;
18+
CREATE DATABASE IF NOT EXISTS `fphp8` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
19+
USE `fphp8`;
20+
21+
-- --------------------------------------------------------
22+
23+
--
24+
-- Structure de la table `doctrine_migration_versions`
25+
--
26+
27+
DROP TABLE IF EXISTS `doctrine_migration_versions`;
28+
CREATE TABLE IF NOT EXISTS `doctrine_migration_versions` (
29+
`version` varchar(191) NOT NULL,
30+
`executed_at` datetime DEFAULT NULL,
31+
`execution_time` int(11) DEFAULT NULL,
32+
PRIMARY KEY (`version`)
33+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
34+
35+
--
36+
-- Déchargement des données de la table `doctrine_migration_versions`
37+
--
38+
39+
INSERT INTO `doctrine_migration_versions` (`version`, `executed_at`, `execution_time`) VALUES
40+
('DoctrineMigrations\\Version20250113100154', '2025-01-14 10:00:30', 824);
41+
42+
-- --------------------------------------------------------
43+
44+
--
45+
-- Structure de la table `messenger_messages`
46+
--
47+
48+
DROP TABLE IF EXISTS `messenger_messages`;
49+
CREATE TABLE IF NOT EXISTS `messenger_messages` (
50+
`id` bigint(20) NOT NULL AUTO_INCREMENT,
51+
`body` longtext NOT NULL,
52+
`headers` longtext NOT NULL,
53+
`queue_name` varchar(190) NOT NULL,
54+
`created_at` datetime NOT NULL COMMENT '(DC2Type:datetime_immutable)',
55+
`available_at` datetime NOT NULL COMMENT '(DC2Type:datetime_immutable)',
56+
`delivered_at` datetime DEFAULT NULL COMMENT '(DC2Type:datetime_immutable)',
57+
PRIMARY KEY (`id`),
58+
KEY `IDX_75EA56E0FB7336F0` (`queue_name`),
59+
KEY `IDX_75EA56E0E3BD61CE` (`available_at`),
60+
KEY `IDX_75EA56E016BA31DB` (`delivered_at`)
61+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
62+
63+
-- --------------------------------------------------------
64+
65+
--
66+
-- Structure de la table `php_function`
67+
--
68+
69+
DROP TABLE IF EXISTS `php_function`;
70+
CREATE TABLE IF NOT EXISTS `php_function` (
71+
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
72+
`title` varchar(120) NOT NULL,
73+
`slug` varchar(125) NOT NULL,
74+
`description` varchar(255) NOT NULL,
75+
`text` longtext NOT NULL,
76+
`visibility` tinyint(1) NOT NULL DEFAULT 1,
77+
`created_at` datetime NOT NULL DEFAULT current_timestamp(),
78+
`updated_at` datetime DEFAULT NULL,
79+
PRIMARY KEY (`id`)
80+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
81+
COMMIT;

0 commit comments

Comments
 (0)