-
-
Notifications
You must be signed in to change notification settings - Fork 26
92 lines (76 loc) · 2.64 KB
/
tests.yml
File metadata and controls
92 lines (76 loc) · 2.64 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
name: tests
on:
workflow_dispatch:
push:
paths:
- '**.php'
- '.composer.*'
- '.github/workflows/tests.yml'
- 'phpunit.xml'
jobs:
tests:
runs-on: ubuntu-18.04
if: "! contains(github.event.head_commit.message, '[skip ci]')"
strategy:
fail-fast: true
matrix:
php:
- 7.1.3
- 7.2
- 7.3
- 7.4
name: Run tests on PHP ${{ matrix.php }}
env:
DB_HOST: 127.0.0.1
DB_USERNAME: root
DB_PASSWORD: root
DB_DATABASE: doika_test
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, json, mbstring, pdo, pdo_mysql, zip # keep in sync with composer.json
tools: composer:v2
coverage: none
- name: Get Composer Cache Directory
id: composer-cache-dir
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.composer-cache-dir.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-${{ matrix.php }}-composer-
- name: Run composer install
if: steps.composer-cache-dir.outputs.cache-hit != 'true' # run composer install only when actions/cache haven’t restored cached /vendor dir
run: composer install -q --no-interaction --no-scripts --no-progress --prefer-dist --no-ansi
- name: Prepare Laravel application
run: |
cp .env.example .env
php artisan key:generate
- name: Create testing DB
run: |
sudo /etc/init.d/mysql start --explicit_defaults_for_timestamp
mysql -u root -proot -e 'CREATE DATABASE IF NOT EXISTS `doika_test`;'
- name: Cache NPM dependencies
uses: actions/cache@v2
id: npm-node_modules-cache
with:
path: node_modules
key: npm-${{ hashFiles('package-lock.json') }}
- name: Check Laravel routes
run: php artisan route:list
- name: Install NPM dependencies
if: steps.npm-cache.outputs.cache-hit != 'true' # run npm install only when actions/cache haven't restored cached /node_modules dir
run: |
npm config set registry http://registry.npmjs.org/
npm ci
- name: Build front-end assets
run: npm run dev
- name: Execute PHP tests
run: composer test:ci
- name: Check for missing translations
run: php artisan translations:missing