-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (61 loc) · 2 KB
/
test-and-qa.yaml
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
name: test-and-qa
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
qa:
runs-on: ubuntu-latest
steps:
- uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
- uses: actions/checkout@v3
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.json') }}
- name: Install Dependencies
run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Check CS-Fixer
run: composer cs:check
- name: Check PHPStan
run: composer phpstan
container-test-job:
runs-on: ubuntu-latest
# from https://ldarren.medium.com/number-of-ways-to-setup-database-in-github-actions-2cd48df9faae
services:
db:
image: mariadb:10.10.2
env:
MYSQL_ROOT_PASSWORD: 'pimcore'
MYSQL_DATABASE: 'pimcore_test'
MYSQL_USER: 'pimcore'
MYSQL_PASSWORD: 'pimcore'
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
ports:
- 3306:3306
steps:
- uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
- uses: actions/checkout@v3
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.json') }}
- name: Install Dependencies
run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: composer tests
env:
DB_URL: 'mysql://pimcore:pimcore@127.0.0.1:3306/pimcore_test?serverVersion=mariadb-10.10.2'