-
-
Notifications
You must be signed in to change notification settings - Fork 363
120 lines (106 loc) · 3.58 KB
/
php_tests.yml
File metadata and controls
120 lines (106 loc) · 3.58 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
name: PHP Tests
on:
workflow_call:
secrets:
CODECOV_TOKEN:
required: true
description: 'codecov token secret'
permissions:
contents: read
jobs:
tests:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read
name: ${{ matrix.php-version }} - ${{ matrix.sql-versions }} -- ${{ matrix.test-suite }}
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- 8.4
- 8.5
sql-versions:
- mariadb
- postgresql
- sqlite
test-suite:
- Unit
- Feature_v2
- Install
- Webshop
- ImageProcessing
- Precomputing
exclude:
# Some skips to reduce the number of runs
- php-version: 8.4
test-suite: Unit
- php-version: 8.4
test-suite: Feature_v2
- php-version: 8.4
test-suite: Webshop
- php-version: 8.4
test-suite: ImageProcessing
- php-version: 8.4
test-suite: Precomputing
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: 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:
# Maps tcp port 5432 on service container to the host
- 5432:5432
env:
extensions: bcmath, curl, dom, gd, imagick, json, libxml, mbstring, pcntl, pdo, pdo_sqlite, pdo_mysql, pdo_pgsql, pgsql, sqlite3, zip
steps:
- name: Harden Runner
uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set Up Imagick, FFmpeg & Exiftools
run: |
sudo apt-get update
sudo apt-get --fix-broken install
sudo apt-get -y install ffmpeg libimage-exiftool-perl
- name: setup Databases
run: |
sudo service mysql start
touch database/database.sqlite
mysql -uroot -proot -e 'create database homestead_test;'
- name: Setup PHP Action
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
coverage: xdebug
tools: pecl, composer
- name: Install Composer dependencies
uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # 3.1.1
- name: copy Env
run: |
cp .github/workflows/.env.${{ matrix.sql-versions }} .env
- name: Generate secure key & Optimize application & Migrate
run: |
php artisan key:generate
php artisan optimize
php artisan migrate
- name: Apply tests ${{ matrix.test-suite }}
run: XDEBUG_MODE=coverage vendor/bin/phpunit --configuration phpunit.ci.xml --testsuite ${{ matrix.test-suite }}
- name: Make sure we can go backward
run: php artisan migrate:rollback
- name: Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}