-
Notifications
You must be signed in to change notification settings - Fork 2
84 lines (70 loc) · 2.37 KB
/
php-test.yml
File metadata and controls
84 lines (70 loc) · 2.37 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
name: PHP Test Suite
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions: # added using https://github.com/step-security/secure-repo
contents: read
jobs:
php-test:
runs-on: ubuntu-24.04
strategy:
matrix:
php-versions: [ '8.4' ]
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: aspirecloud_testing
ports:
- 5432/tcp
options: --health-cmd pg_isready --health-interval 2s --health-timeout 2s --health-retries 10
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup PHP
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, pgsql
# not doing coverage in CI yet
# coverage: xdebug
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install
- name: Prepare tests
run: |
cp .env.example .env
php artisan key:generate
php artisan migrate
env:
CACHE_STORE: array
DB_HOST: localhost
DB_PORT: ${{ job.services.postgres.ports[5432] }}
DB_USERNAME: postgres
DB_PASSWORD: postgres
DB_DATABASE: aspirecloud_testing
- name: Run Pest
run: vendor/bin/pest --ci
env:
CACHE_STORE: array
DB_HOST: localhost
DB_PORT: ${{ job.services.postgres.ports[5432] }}
DB_USERNAME: postgres
DB_PASSWORD: postgres
DB_DATABASE: aspirecloud_testing