-
Notifications
You must be signed in to change notification settings - Fork 49
132 lines (116 loc) · 4.88 KB
/
tests.yml
File metadata and controls
132 lines (116 loc) · 4.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: 🧪 Tests
on: [push, pull_request]
jobs:
tests:
name: 🧪 Symfony ${{ matrix.symfony-version || 'Ø' }} - 🐘 ${{ matrix.php-version }} - 🏳️ ${{ matrix.composer-flags || 'Ø' }} - 💾 ${{ matrix.mysql-client || 'Ø' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# the default job will test ^7.4 for all Symfony packages, with PHP 8.2
php-version: ['8.2']
composer-flags: ['']
symfony-version: ['^7.4']
mysql-client: [ "default-mysql-client" ]
# note: values defined in `matrix` and not in the `include:` section will be empty in jobs
include:
- php-version: 8.1
# Use "update" instead of "install" since it allows using the "--prefer-lowest" option
composer-flags: "update --prefer-lowest"
- php-version: 8.1
# add a specific job to test ^5.4 for all Symfony packages
symfony-version: "^5.4"
# `theofidry/alice-data-fixtures:1.6.0` and `doctrine/dbal:^4.0` cause issues:
# Error: Call to undefined method Doctrine\DBAL\Connection::exec()
# and avoid error between doctrine/mongodb-odm-bundle and the version of Mongo installed on the CI runner
composer-flags: "require doctrine/dbal:^3.0 --ignore-platform-req=ext-mongodb"
- php-version: 8.2
symfony-version: "^6.4"
- php-version: 8.2
symfony-version: "^7.4"
# add a specific job to test mysqldump from MariaDB
mysql-client: "mariadb-client"
- php-version: 8.3
symfony-version: "^7.4"
- php-version: 8.4
symfony-version: "^7.4"
- php-version: 8.5
symfony-version: "^7.4"
- php-version: 8.4
symfony-version: "^8.0"
- php-version: 8.5
symfony-version: "^8.0"
services:
mariadb:
image: mariadb:11.0
env:
MARIADB_ROOT_PASSWORD: root
MARIADB_DATABASE: acme
ports:
- 3306:3306
postgresql:
image: postgres:15-alpine
env:
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: 'postgres'
POSTGRES_DB: 'postgres'
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
mongodb:
image: mongo:5
ports:
- 27017:27017
steps:
- name: 📦 Install mysqldump
run: |
sudo apt update
sudo apt install -y -q ${{ matrix.mysql-client || 'default-mysql-client' }}
mysqldump --version
- name: 📦 Install mongodb database tools
run: |
wget --quiet https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian92-x86_64-100.3.1.deb
sudo apt install ./mongodb-database-tools-*.deb
rm -f mongodb-database-tools-*.deb
- name: Checkout
uses: actions/checkout@v6
- name: 🐘 Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
- name: Get composer cache directory
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v5
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ matrix.symfony-version }}-
- name: 🎵 Require Symfony
if: matrix.symfony-version != ''
run: |
composer require --no-update symfony/flex
composer config extra.symfony.require "${{ matrix.symfony-version }}"
composer require --no-update symfony/framework-bundle=${{ matrix.symfony-version }}
- name: 🎵 Install Composer dependencies
if: matrix.composer-flags == ''
run: composer install
- name: 🎵 Install Composer dependencies with options
if: matrix.composer-flags != ''
run: composer ${{ matrix.composer-flags }}
- name: 🎵 Show Composer dependencies
run: composer show
- name: Set up hosts file
run: echo '127.0.0.1 mariadb postgres mongodb' | sudo tee -a /etc/hosts
- name: 🧪 Run tests
# Run tests twice to ensure that tests are idempotent even if database caching is enabled
run: |
php ./vendor/bin/phpunit --testdox --process-isolation
php ./vendor/bin/phpunit --testdox --process-isolation