-
Notifications
You must be signed in to change notification settings - Fork 13
144 lines (137 loc) · 4.81 KB
/
coverage.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
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Manual Coverage
on: workflow_dispatch
env:
PACKAGE_NAME: 'oxid-esales/amazon-pay-module'
MODULE_PATH: 'osc/amazonpay'
jobs:
install_shop_with_module:
strategy:
matrix:
php: [ '7.4' ]
runs-on: ubuntu-latest
steps:
- name: Clone testing environment v3.0.0
run: git clone https://github.com/OXID-eSales/docker-eshop-sdk.git .
- name: Clone the shop
run: git clone --depth 1 https://github.com/OXID-eSales/oxideshop_ce.git --branch b-6.4.x --single-branch source
- name: Cache current installation
uses: actions/cache@v4
with:
path: |
./*
key: coverage-${{ matrix.php }}-${{ github.run_number }}-${{ github.run_attempt }}
- name: Prepare container configuration
run: |
make setup
make addbasicservices
make file=services/selenium-chrome.yml addservice
perl -pi\
-e "s#PHP_VERSION=.*#PHP_VERSION='${{ matrix.php }}'#g;"\
.env
perl -pi\
-e 's#display_errors =.*#display_errors = false#g;'\
-e 'print "xdebug.max_nesting_level=1000\nxdebug.mode=coverage\n\n"'\
containers/php-fpm/custom.ini
perl -pi\
-e 's#/var/www/#/var/www/source/#g;'\
containers/httpd/project.conf
- name: Prepare shop configuration
run: |
cp source/source/config.inc.php.dist source/source/config.inc.php
sed -i "1s+^+SetEnvIf Authorization "\(.*\)" HTTP_AUTHORIZATION=\$1\n\n+" source/source/.htaccess
sed -i -e 's/<dbHost>/mysql/'\
-e 's/<dbUser>/root/'\
-e 's/<dbName>/example/'\
-e 's/<dbPwd>/root/'\
-e 's/<dbPort>/3306/'\
-e 's/<sShopURL>/http:\/\/localhost.local\//'\
-e 's/<sShopDir>/\/var\/www\/source\//'\
-e 's/<sCompileDir>/\/var\/www\/source\/tmp\//'\
source/source/config.inc.php
- name: Start containers
run: |
make up
sleep 2
- name: Checkout current module
uses: actions/checkout@v4
with:
path: source/test-module
- name: Install module
run: |
docker-compose exec -T \
php composer config repositories.${{ env.PACKAGE_NAME }} \
--json '{"type":"path", "url":"./test-module", "options": {"symlink": true}}'
docker-compose exec -T \
php composer require ${{ env.PACKAGE_NAME }}:* --no-interaction --no-update
- name: Install dependencies and reset shop
run: |
docker-compose exec -T php composer update --no-interaction
docker-compose exec -T php php vendor/bin/reset-shop
- name: Show docker log
if: always()
run: |
docker-compose logs
- name: Stop containers
if: always()
run: |
docker-compose down
sleep 2
- name: Upload configuration artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: Configs-${{ matrix.php }}
path: |
docker-compose.yml
source/composer.json
source/composer.lock
source/config.inc.php
data/php/logs/error_log.txt
unit_tests:
strategy:
matrix:
php: [ '7.4' ]
needs: [ install_shop_with_module ]
runs-on: ubuntu-latest
steps:
- name: Load current installation from cache
uses: actions/cache@v4
with:
path: |
./*
key: coverage-${{ matrix.php }}-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: |
coverage-${{ matrix.php }}-${{ github.run_number }}-${{ github.run_attempt }}
- name: Start containers
run: |
make up
sleep 2
- name: Run tests
run: |
docker-compose exec -T \
-e PARTIAL_MODULE_PATHS=${{ env.MODULE_PATH }} \
-e ACTIVATE_ALL_MODULES=1 \
-e RUN_TESTS_FOR_SHOP=0 \
-e RUN_TESTS_FOR_MODULES=0 \
-e XDEBUG_MODE=coverage \
-e ADDITIONAL_TEST_PATHS='/var/www/vendor/${{ env.PACKAGE_NAME }}/tests' \
php php vendor/bin/runtests \
--coverage-clover=/var/www/coverage.xml \
--coverage-html=/var/www/coverage \
--coverage-text \
--log-junit=/var/www/phpunit.xml \
AllTestsUnit
- name: Stop containers
if: always()
run: |
docker-compose down
sleep 2
- name: Upload log artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: TestsLog-${{ matrix.php }}
path: |
source/coverage.xml
source/phpunit.xml
source/coverage