Skip to content

Commit e714eb6

Browse files
committed
WIP
1 parent d68d409 commit e714eb6

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/phpunit.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Testing Code with PHPUnit
2+
3+
on:
4+
push: # (or pull requests)
5+
paths:
6+
- '.github/workflows/**'
7+
- '**.php'
8+
- 'app/**'
9+
- 'tests/**'
10+
- 'phpunit.xml'
11+
- 'composer.json'
12+
- 'composer.lock'
13+
14+
jobs:
15+
laravel:
16+
name: Laravel (PHP ${{ matrix.php-versions }})
17+
runs-on: ubuntu-latest
18+
env:
19+
DB_DATABASE: laravel
20+
DB_USERNAME: root
21+
DB_PASSWORD: secret
22+
BROADCAST_DRIVER: log
23+
CACHE_DRIVER: file
24+
QUEUE_CONNECTION: sync
25+
SESSION_DRIVER: cookie
26+
MAIL_MAILER: array
27+
MAIL_FROM_ADDRESS: [email protected]
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
php-versions: ['8.3']
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
- name: Setup PHP, with composer and extensions
36+
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
37+
with:
38+
php-version: ${{ matrix.php-versions }}
39+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
40+
coverage: pcov #optional
41+
tools: composer:v2
42+
env:
43+
COMPOSER_TOKEN: ${{ secrets.TOKEN }}
44+
- name: Get composer cache directory
45+
id: composer-cache
46+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
47+
- name: Cache composer dependencies
48+
uses: actions/cache@v3
49+
with:
50+
path: ${{ steps.composer-cache.outputs.dir }}
51+
# Use composer.json for key, if composer.lock is not committed.
52+
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
53+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
54+
restore-keys: ${{ runner.os }}-composer-
55+
- name: Install Composer dependencies
56+
run: composer install --no-progress --prefer-dist --optimize-autoloader
57+
- name: TimeZone ⏰
58+
run: |
59+
sudo timedatectl set-timezone UTC
60+
timedatectl
61+
- name: Prepare the application
62+
run: |
63+
php -r "file_exists('.env') || copy('.env.example', '.env');"
64+
php artisan key:generate
65+
- name: Clear Config
66+
run: php artisan config:clear
67+
- name: Run Migration
68+
run: php artisan migrate -v
69+
- name: Test with phpunit
70+
run: vendor/bin/phpunit --coverage-text

0 commit comments

Comments
 (0)