Skip to content

Commit 2f64758

Browse files
authored
Merge pull request #132 from NativePHP/feature/tests-workflow
feat: configure tests workflow
2 parents 8b17e8c + ffc7e3b commit 2f64758

File tree

4 files changed

+472
-1
lines changed

4 files changed

+472
-1
lines changed

.github/workflows/tests.yaml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Unit and features tests
2+
# also useful for testing new php versions
3+
name: Tests
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches-ignore:
8+
- 'dependabot/npm_and_yarn/*'
9+
10+
jobs:
11+
tests:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ ubuntu-latest ]
16+
php: [ 8.3 ]
17+
# services:
18+
# redis:
19+
# image: redis
20+
# ports:
21+
# - 6379:6379
22+
# options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
23+
24+
steps:
25+
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
29+
- name: Setup PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: ${{ matrix.php }}
33+
tools: composer:v2
34+
coverage: xdebug
35+
36+
- name: Copy .env
37+
run: cp .env.example .env
38+
39+
- name: Get composer cache directory
40+
id: composer-cache
41+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
42+
43+
- name: Cache Composer dependencies
44+
uses: actions/cache@v4
45+
with:
46+
path: ${{ steps.composer-cache.outputs.dir }}
47+
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
48+
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-
49+
50+
- name: Install Dependencies
51+
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
52+
53+
- name: Generate Application Key
54+
run: php artisan key:generate
55+
56+
- name: Compile Assets
57+
run: npm install && npm run build
58+
59+
- name: Run tests
60+
env:
61+
DB_CONNECTION: sqlite
62+
DB_DATABASE: ":memory:"
63+
QUEUE_CONNECTION: sync
64+
run: ./vendor/bin/phpunit --testdox

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"php": "^8.1",
1212
"artesaos/seotools": "^1.2",
1313
"blade-ui-kit/blade-heroicons": "^2.3",
14+
"doctrine/dbal": "^3.9",
1415
"guzzlehttp/guzzle": "^7.2",
1516
"laravel/cashier": "^15.6",
1617
"laravel/framework": "^10.10",

0 commit comments

Comments
 (0)