-
Notifications
You must be signed in to change notification settings - Fork 19
131 lines (111 loc) · 5.29 KB
/
main.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
131
name: Tests
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
env:
MODULE_NAME: PayonePayment
MODULE_DIR: custom/plugins/PayonePayment
COMPOSER_NAME: payone-gmbh/shopware-6
TEST_DATABASE_URL: "mysql://root:[email protected]:3306/shopware"
permissions:
contents: read
jobs:
ci-current:
name: SW ${{ matrix.shopware-version }}, PHP ${{ matrix.php-version }}, MySQL ${{ matrix.mysql-version }}
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ '8.2', '8.3' ]
mysql-version: [ '8.0' ]
shopware-version: [ 'v6.6.0.0', 'v6.6.1.0', 'v6.6.2.0', 'v6.6.3.0', 'v6.6.4.0', 'v6.6.5.0' ]
fail-fast: false
max-parallel: 10
services:
mysql:
image: mysql:${{ matrix.mysql-version }}
env:
MYSQL_DATABASE: shopware
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
steps:
- name: Install PHP
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, curl, dom, fileinfo, gd, iconv, intl, json, xml, mbstring, pdo, phar, zip, sodium, pdo_mysql
tools: composer:2.2
coverage: none # we should implement code-coverage-report in the future if we have more tests for everything
- name: "Check PHP Version"
run: php -v
- name: "Check Composer Version"
run: composer -V
- name: "Check PHP Extensions"
run: php -m
- name: "checkout Shopware"
uses: actions/checkout@v3
with:
repository: shopware/production
ref: ${{ matrix.shopware-version }}
- name: "Checkout ${{ env.COMPOSER_NAME }}"
uses: actions/checkout@v3
with:
path: ${{ env.MODULE_DIR }}
- name: "Get composer cache directory"
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Cache Composer dependencies"
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ matrix.operating-system }}-${{ matrix.php-version }}-${{ matrix.shopware-version }}-${{ hashFiles('**/composer.lock') }}
- name: "Install Shopware dependencies"
# Install Shopware with --no-dev to prevent that dev-tools of the module got in conflict with the tools of shopware
run: |
composer req shopware/core:${{ matrix.shopware-version }} shopware/administration:* shopware/storefront:* --no-update
composer remove shopware/elasticsearch --no-update
composer install
- name: "Install ${{ env.COMPOSER_NAME }}"
run: |
composer config prefer-stable true
composer config minimum-stability dev
composer config repositories.local-plugins '{ "type": "path", "url": "custom/plugins/*", "options": { "symlink": true } }'
composer req ${{ env.COMPOSER_NAME }} --no-scripts
- name: "Install DEV-Tools"
working-directory: ${{ env.MODULE_DIR }}
run: |
composer remove shopware/* --no-update
composer install
- name: "Run PHPStan"
working-directory: ${{ env.MODULE_DIR }}
run: ./vendor/bin/phpstan
- name: "Check Code style (easy-coding-style)"
working-directory: ${{ env.MODULE_DIR }}
run: ./vendor/bin/ecs
- name: "Check Code style (rector)"
working-directory: ${{ env.MODULE_DIR }}
run: ./vendor/bin/rector --dry-run
# Workaround. The variables are required for shopware to work properly during unit-testing
- name: "Install Shopware for unit-testing"
run: |
echo DATABASE_URL=${{ env.TEST_DATABASE_URL }} >> .env
echo MAILER_DSN=null://null >> .env
echo OPENSEARCH_URL=http://localhost:9200 >> .env
echo LOCK_DSN=flock >> .env
echo MAILER_DSN=null://null >> .env
echo APP_SECRET=se$cr$t >> .env
echo REDIS_CACHE_HOST=127.0.0.1 >> .env
echo REDIS_CACHE_PORT=123 >> .env
echo REDIS_SESSION_HOST=127.0.0.1 >> .env
echo REDIS_SESSION_PORT=123 >> .env
echo SHOPWARE_HTTP_CACHE_ENABLED=0 >> .env
echo STOREFRONT_PROXY_URL=http://localhost:80 >> .env
bin/console system:install --basic-setup
- name: "Run PHPUnit Tests"
working-directory: custom/plugins/${{ env.MODULE_NAME }}
run: SYMFONY_DEPRECATIONS_HELPER=disabled ./vendor/bin/phpunit --testdox