-
Notifications
You must be signed in to change notification settings - Fork 208
140 lines (123 loc) · 4.25 KB
/
feature.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Feature Build & Test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
unitary:
name: Build & Test (UT) ${{ matrix.php }}/${{ matrix.platform }}
strategy:
matrix:
platform: [ 'ubuntu-latest' ]
php: [ '8.2' ]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: Setup locales
run: |
sudo locale-gen es_ES.UTF-8 en_US.UTF-8 && sudo update-locale
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl, gd, ldap, gettext, pdo_mysql
# tools: phpunit
coverage: xdebug
env:
fail-fast: true
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: |
composer install \
--prefer-dist \
--ignore-platform-reqs \
--no-interaction \
--no-plugins \
--no-scripts \
--prefer-dist
- name: Unitary tests
uses: paambaati/codeclimate-action@v5
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
XDEBUG_MODE: coverage
with:
coverageCommand: ./vendor/bin/phpunit -c ./tests/phpunit.xml --group unitary --testsuite core
coverageLocations: ./tests/_output/coverage-clover.xml:clover
integration:
name: Build & Test (IT) ${{ matrix.php }}/${{ matrix.platform }}
if: ${{ vars.TESTS_INTEGRATION_ENABLED == 'true' }}
needs: [ unitary ]
strategy:
matrix:
platform: [ 'ubuntu-latest' ]
php: [ '8.1', '8.2' ]
runs-on: ${{ matrix.platform }}
env:
DB_SERVER: 127.0.0.1
DB_NAME: syspass
DB_USER: root
DB_PASS: syspass
DB_PORT: 3306
services:
mariadb:
image: mariadb:10.3
env:
MYSQL_DATABASE: ${{ env.DB_NAME }}
MYSQL_ROOT_PASSWORD: ${{ env.DB_PASS }}
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v3
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl, gd, ldap, gettext, pdo_mysql
# tools: phpunit
coverage: xdebug
env:
fail-fast: true
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: |
composer install \
--prefer-dist \
--ignore-platform-reqs \
--no-interaction \
--no-plugins \
--no-scripts \
--prefer-dist
- name: Setup database
run: |
set -euo pipefail
MYSQL_OPTS="-h ${DB_SERVER} -P ${DB_PORT} -u ${DB_USER} -p${DB_PASS}"
mysql ${MYSQL_OPTS} -e 'DROP DATABASE IF EXISTS `'"$DB_NAME"'`;'
mysql ${MYSQL_OPTS} -e 'CREATE DATABASE `'"${DB_NAME}"'` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;'
mysql ${MYSQL_OPTS} ${DB_NAME} < ./schemas/dbstructure.sql
- name: Integration tests
uses: paambaati/codeclimate-action@v4
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
XDEBUG_MODE: coverage
with:
coverageCommand: ./vendor/bin/phpunit -c ./tests/phpunit.xml --testsuite core
coverageLocations: ./tests/_output/coverage-clover.xml:clover