-
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (82 loc) · 2.58 KB
/
Copy pathtests.yml
File metadata and controls
100 lines (82 loc) · 2.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
name: Tests
on:
pull_request:
branches: [ "main" ]
workflow_call:
workflow_dispatch:
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
test:
- name: lint
command: composer test:lint
needs-db: 'false'
- name: refactor
command: composer test:refactor
needs-db: 'false'
- name: type-coverage
command: composer test:type-coverage
needs-db: 'true'
- name: unit
command: composer test:unit
needs-db: 'true'
fail-fast: false
name: ${{ matrix.test.name }}
steps:
- name: Checkout code
uses: actions/checkout@v7.0.0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
coverage: xdebug
- name: Cache Composer dependencies
uses: actions/cache@v6.1.0
with:
path: vendor
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Setup Node.js environment
if: ${{ matrix.test.needs-db == 'true' }}
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- name: Copy .env
if: ${{ matrix.test.needs-db == 'true' }}
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Build assets
if: ${{ matrix.test.needs-db == 'true' }}
run: |
npm ci
npm run build
- name: Generate key
if: ${{ matrix.test.needs-db == 'true' }}
run: php artisan key:generate
- name: Directory Permissions
if: ${{ matrix.test.needs-db == 'true' }}
run: chmod -R 777 storage bootstrap/cache
- name: Create Database
if: ${{ matrix.test.needs-db == 'true' }}
run: |
mkdir -p database
touch database/database.sqlite
- name: Install Chrome for Puppeteer
if: ${{ matrix.test.needs-db == 'true' }}
run: npx --yes puppeteer browsers install chrome
- name: Run Migrations
if: ${{ matrix.test.needs-db == 'true' }}
run: php artisan migrate --force
- name: Run ${{ matrix.test.name }}
if: ${{ matrix.test.needs-db == 'true' }}
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: ${{ matrix.test.command }}
- name: Run ${{ matrix.test.name }}
if: ${{ matrix.test.needs-db == 'false' }}
run: ${{ matrix.test.command }}