-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (82 loc) · 2.95 KB
/
tests-php.yml
File metadata and controls
92 lines (82 loc) · 2.95 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
name: 'PHP Unit Tests'
on:
workflow_dispatch:
pull_request:
paths:
- 'src/**'
- 'tests/**'
- 'composer.json'
push:
branches:
- 'master'
paths:
- 'src/**'
- 'tests/**'
- 'composer.json'
# Cancel unfinished builds if a new commit is made before it's completed.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php-versions: ['8.2']
permissions:
contents: write
pull-requests: write
steps:
# Mandatory : fetch the current repository
- name: Checkout repository
uses: actions/checkout@v4
# To be faster, use cache system for the Composer
- name: Get Composer Cache Directory
id: composer-dev-cache
run: |
echo "name=dir::$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer (vendor)
uses: actions/cache@v3
with:
path: ${{ steps.composer-dev-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
# Define the right PHP environment
# https://github.com/shivammathur/setup-php (community)
- name: Environment for PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, dom, filter, gd, iconv, json, mbstring, pdo
tools: composer:v2
coverage: none
env:
update: true
# Ensure that composer.json is valid
# - name: Validate composer.json and composer.lock
# run: composer validate
# Log the PHP version in use, and copy the "prod" env file to the "local" env file
# - name: PHP utils
# run: |
# php -v
# cp .env.prod .env.local
# Install composer dependencies for dev.
- name: Composer install & dump-env
run: |
composer install
# —— Symfony ——————————————————————————————————————————————————————————
# - name: Check Symfony requirements
# run: vendor/bin/requirements-checker
# - name: Check the Symfony console
# run: bin/console -V
# Install database
- name: Doctrine Create migration
run: php bin/console --env=test doctrine:migrations:diff
- name: Doctrine Install/Migrate
run: php bin/console --env=test doctrine:migrations:migrate
# Install composer dependencies, and dump env
- name: Run PHP Unit tests
run: |
php bin/phpunit --stop-on-failure