-
-
Notifications
You must be signed in to change notification settings - Fork 366
110 lines (96 loc) · 3.29 KB
/
php_tests.yml
File metadata and controls
110 lines (96 loc) · 3.29 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
name: PHP Tests
on:
workflow_call:
inputs:
test-suite:
required: true
type: string
description: 'The test suite to run'
env-file:
required: true
type: string
description: 'The env files to use'
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 }} -- ${{ inputs.test-suite }}
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- 8.3
- 8.4
sql-versions:
- mariadb
- postgresql
- sqlite
# 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@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.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@cf4cade2721270509d5b1c766ab3549210a39a2a # 2.33.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/${{ inputs.env-file }}.${{ 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 ${{ inputs.test-suite }}
run: XDEBUG_MODE=coverage vendor/bin/phpunit --configuration phpunit.ci.xml --testsuite ${{ inputs.test-suite }}
- name: Make sure we can go backward
run: php artisan migrate:rollback
- name: Codecov
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}