-
Notifications
You must be signed in to change notification settings - Fork 7
130 lines (120 loc) · 4.87 KB
/
php.yml
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
name: liquetsoft_fias
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
name: Linting and testing (PHP ${{ matrix.php-versions }}, Symfony components ${{ matrix.symfony-components-versions }})
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php-versions: ['8.2', '8.3']
symfony-components-versions: ['^5.0', '^6.0', '^7.0']
steps:
- uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Check PHP Version
run: php -v
- name: Validate composer.json and composer.lock
run: composer validate
- name: Set up Symfony components versions
run: "sed -i -E \"s#\\\"(symfony/.+)\\\".*:.*\\\"(.+)\\\"#\\\"\\1\\\":\\\"${{ matrix.symfony-components-versions }}\\\"#g\" composer.json"
- name: Show composer.json
run: cat composer.json
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Run test suite
run: composer run-script test
- name: Run linters
run: composer run-script linter
symfony:
name: Testing Symfony installation (PHP ${{ matrix.php-versions }}, Symfony ${{ matrix.symfony-versions }})
runs-on: ubuntu-latest
env:
DB_DATABASE: symfony
DB_USERNAME: root
DB_PASSWORD: password
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: symfony
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
matrix:
php-versions: ['8.2', '8.3']
symfony-versions: ['5.4', '6.4', '7.1']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, fileinfo, mysql, curl
- name: Start mysql service
run: sudo /etc/init.d/mysql start
- name: Cache Symfony app
id: symfony-app-cache
uses: actions/cache@v2
with:
path: symfony_app_tmp
key: ${{ runner.os }}-symfony-${{ matrix.symfony-versions }}-${{ matrix.php-versions }}
- name: Install Symfony app
if: steps.symfony-app-cache.outputs.cache-hit != 'true'
run: |
composer create-project symfony/skeleton:"${{ matrix.symfony-versions }}.*" symfony_app_tmp
cd symfony_app_tmp
composer require webapp
- name: Prepare fresh Symfony app
run: |
cp -r symfony_app_tmp example_app
- name: Branch used
id: extract_branch
run: |
if [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then
echo "::set-output name=branch::$(echo ${GITHUB_REF##*/})"
elif [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
echo "::set-output name=branch::$(echo $GITHUB_HEAD_REF)"
else
echo "::set-output name=branch::INVALID_EVENT_BRANCH_UNKNOWN"
fi
- name: Install FIAS
run: |
unzip ./Tests/Pipeline/_fixtures/install_AddressObject.zip -d ./example_app/fias-data-install
unzip ./Tests/Pipeline/_fixtures/update_AddressObject.zip -d ./example_app/fias-data-update
cd example_app
composer req "liquetsoft/fias-symfony:dev-${{ steps.extract_branch.outputs.branch }}" -W
cp ./../Tests/MockEntities/SymfonyTestAddrObj.php src/Entity/AddrObj.php
cp ./../Tests/MockEntities/SymfonyTestFiasVersion.php src/Entity/FiasVersion.php
echo "liquetsoft_fias:" > config/packages/liquetsoft_fias.yaml
echo " version_manager_entity: App\Entity\FiasVersion" >> config/packages/liquetsoft_fias.yaml
echo " entity_bindings:" >> config/packages/liquetsoft_fias.yaml
echo " ADDR_OBJ: App\Entity\AddrObj" >> config/packages/liquetsoft_fias.yaml
echo "APP_ENV=dev" > .env
echo "APP_SECRET=test" >> .env
echo "DATABASE_URL=mysql://root:password@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/symfony?serverVersion=5.7" >> .env
echo "MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0" >> .env
php bin/console cache:clear
php bin/console doctrine:schema:create -n
- name: Lint container
run: |
cd example_app
php bin/console lint:container
- name: Test FIAS
run: |
cd example_app
php bin/console liquetsoft:fias:truncate
php bin/console liquetsoft:fias:install_from_folder ./fias-data-install
php bin/console liquetsoft:fias:update_from_folder ./fias-data-update