Skip to content

Commit 6faf209

Browse files
committed
👷 test github action
1 parent d90471e commit 6faf209

File tree

3 files changed

+93
-4
lines changed

3 files changed

+93
-4
lines changed

.github/workflows/tests.yml

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches: [ master, next ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
php-version: [ '8.1', '8.2' ]
18+
laravel-version: [ '^8.0', '^9.0', '^10.0' ]
19+
database: [ 'sqlite', 'mysql', 'pgsql' ]
20+
21+
name: Tests on PHP ${{ matrix.php-version }} with Laravel ${{ matrix.laravel-version }} and ${{ matrix.database }}
22+
23+
services:
24+
mysql:
25+
image: mysql:8
26+
env:
27+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
28+
MYSQL_DATABASE: rest
29+
ports:
30+
- 3306:3306
31+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
32+
33+
pgsql:
34+
image: postgres:10.8
35+
env:
36+
POSTGRES_USER: postgres
37+
POSTGRES_PASSWORD: postgres
38+
POSTGRES_DB: rest
39+
ports:
40+
- 5432:5432
41+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
42+
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@v3
46+
47+
- name: Setup PHP
48+
uses: shivammathur/setup-php@v2
49+
with:
50+
php-version: ${{ matrix.php-version }}
51+
coverage: none
52+
53+
- name: Validate composer.json and composer.lock
54+
run: composer validate
55+
56+
- name: Cache Composer packages
57+
id: composer-cache
58+
uses: actions/cache@v3
59+
with:
60+
path: vendor
61+
key: ${{ runner.os }}-php-${{ matrix.php-version }}-laravel-${{ matrix.laravel-version }}-${{ hashFiles('**/composer.lock') }}
62+
restore-keys: |
63+
${{ runner.os }}-php-${{ matrix.php-version }}-laravel-${{ matrix.laravel-version }}-
64+
65+
- name: Install dependencies
66+
if: steps.composer-cache.outputs.cache-hit != 'true'
67+
run: composer update --with "illuminate/contracts=${{ matrix.laravel-version }}" --prefer-dist --no-progress
68+
69+
- name: Run test suite with Sqlite
70+
if: matrix.database == 'sqlite'
71+
run: vendor/bin/phpunit --debug
72+
env:
73+
DB_CONNECTION: sqlite
74+
DB_DATABASE: ':memory:'
75+
76+
- name: Run test suite with MySQL
77+
if: matrix.database == 'mysql'
78+
run: vendor/bin/phpunit --debug
79+
env:
80+
DB_CONNECTION: mysql
81+
DB_PORT: ${{ job.services.mysql.ports[3306] }}
82+
DB_DATABASE: rest
83+
DB_USERNAME: root
84+
85+
- name: Run test suite with PostgreSQL
86+
if: matrix.database == 'pgsql'
87+
run: vendor/bin/phpunit --debug
88+
env:
89+
DB_CONNECTION: pgsql
90+
DB_PORT: ${{ job.services.pgsql.ports[5432] }}
91+
DB_DATABASE: rest
92+
DB_USERNAME: postgres
93+
DB_PASSWORD: postgres

phpunit.xml

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
<env name="APP_DEBUG" value="true"/>
1515
<env name="BCRYPT_ROUNDS" value="4"/>
1616
<env name="CACHE_DRIVER" value="array"/>
17-
<env name="DB_CONNECTION" value="sqlite"/>
18-
<env name="DB_DATABASE" value=":memory:"/>
1917
<env name="MAIL_MAILER" value="array"/>
2018
<env name="QUEUE_CONNECTION" value="sync"/>
2119
<env name="SESSION_DRIVER" value="array"/>

tests/Unit/RoutesTest.php

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
use Illuminate\Support\Facades\Route;
44
use Lomkit\Rest\Tests\Support\Http\Controllers\ModelController;
55
use Lomkit\Rest\Tests\Support\Http\Controllers\SoftDeletedModelController;
6-
use Orion\Facades\Orion;
7-
use Orion\Tests\Fixtures\App\Http\Controllers\DummyController;
86

97
class RoutesTest extends \Lomkit\Rest\Tests\TestCase
108
{

0 commit comments

Comments
 (0)