Skip to content

Commit 3d79d6a

Browse files
committed
Add Github actions workflow
1 parent 4821197 commit 3d79d6a

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.github/workflows/run-tests.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Tests
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
test:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
os: [ ubuntu-latest ]
12+
php: [ 7.2, 7.3, 7.4 ]
13+
laravel: [ 6.*, 7.*, 8.* ]
14+
dependency-version: [ prefer-stable ]
15+
include:
16+
- laravel: 6.*
17+
testbench: 4.*
18+
- laravel: 7.*
19+
testbench: 5.*
20+
- laravel: 8.*
21+
testbench: 6.*
22+
exclude:
23+
- laravel: 8.*
24+
php: 7.2
25+
26+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
27+
28+
services:
29+
mysql:
30+
image: mysql:5.7
31+
env:
32+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
33+
MYSQL_DATABASE: testing
34+
ports:
35+
- 3306
36+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
37+
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v2
41+
42+
- name: Cache dependencies
43+
uses: actions/cache@v2
44+
with:
45+
path: ~/.composer/cache/files
46+
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
47+
48+
- name: Setup PHP
49+
uses: shivammathur/setup-php@v2
50+
with:
51+
php-version: ${{ matrix.php }}
52+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
53+
coverage: pcov
54+
55+
- name: Install dependencies
56+
run: |
57+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
58+
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
59+
60+
- name: Execute tests
61+
run: vendor/bin/phpunit --coverage-clover=coverage.xml
62+
env:
63+
DB_PORT: ${{ job.services.mysql.ports[3306] }}
64+
65+
- name: Run Codacy Coverage Reporter
66+
uses: codacy/codacy-coverage-reporter-action@master
67+
with:
68+
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
69+
coverage-reports: coverage.xml

0 commit comments

Comments
 (0)