Skip to content

Commit a0aa91c

Browse files
Progi1984Progi1984
authored andcommitted
Added coverage
1 parent 4eb24ac commit a0aa91c

File tree

3 files changed

+39
-4
lines changed

3 files changed

+39
-4
lines changed

.github/workflows/integration.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,24 @@ jobs:
2525
prestashop_version: '9.0.x'
2626
fail-fast: false
2727
steps:
28-
- name: Checkout module code
28+
- name: Checkout Module
2929
uses: actions/checkout@v3
3030
with:
3131
path: ps_apiresources
32-
- uses: actions/checkout@v3
33-
name: Checkout PrestaShop repository
32+
33+
- name: Checkout PrestaShop repository
34+
uses: actions/checkout@v3
3435
with:
3536
fetch-depth: 0
3637
repository: PrestaShop/PrestaShop
3738
path: prestashop
3839
ref: ${{ matrix.prestashop_version }}
40+
3941
- name: Build Docker
4042
timeout-minutes: 15
4143
env:
4244
VERSION: ${{ matrix.php }}-apache
45+
INSTALL_XDEBUG: false ## ${{ (matrix.php == '8.4' && matrix.prestashop_version == 'develop') && true || false }}
4346
run: |
4447
cd prestashop
4548
USER_ID=$(id -u) GROUP_ID=$(id -g) PS_INSTALL_AUTO=0 docker compose build --no-cache && docker compose up -d --force-recreate
@@ -49,6 +52,7 @@ jobs:
4952
fi
5053
bash -l -c 'while [[ "$(curl -L -s -o /dev/null -w %{http_code} 'http://localhost:8001/install-dev/')" != "200" ]]; do echo "waiting for shop install"; sleep 5; done'
5154
USER_ID=$(id -u) GROUP_ID=$(id -g) docker exec prestashop-prestashop-git-1 php bin/console prestashop:module uninstall ps_apiresources
55+
5256
- name: Install Module
5357
run: |
5458
rm -rf prestashop/modules/ps_apiresources
@@ -58,6 +62,25 @@ jobs:
5862
USER_ID=$(id -u) GROUP_ID=$(id -g) docker exec prestashop-prestashop-git-1 composer install --no-interaction --working-dir=/var/www/html/modules/ps_apiresources
5963
USER_ID=$(id -u) GROUP_ID=$(id -g) docker exec prestashop-prestashop-git-1 php bin/console prestashop:module install ps_apiresources
6064
USER_ID=$(id -u) GROUP_ID=$(id -g) docker exec prestashop-prestashop-git-1 composer create-test-db
65+
66+
- name: Install pcov
67+
if: matrix.php == '8.4' && matrix.prestashop_version == 'develop'
68+
run: |
69+
USER_ID=$(id -u) GROUP_ID=$(id -g) docker exec prestashop-prestashop-git-1 pecl install pcov
70+
USER_ID=$(id -u) GROUP_ID=$(id -g) docker exec prestashop-prestashop-git-1 docker-php-ext-enable pcov
71+
6172
- name: Run integration tests
73+
env:
74+
CLI_PHP: ${{ (matrix.php == '8.4' && matrix.prestashop_version == 'develop') && '-d extension=pcov.so -d pcov.enabled=1 -d pcov.directory=./modules/ps_apiresources/ -d pcov.exclude="~(tests|vendor)~" -d memory_limit=-1' || ' ' }}
75+
CLI_PHPUNIT: ${{ (matrix.php == '8.4' && matrix.prestashop_version == 'develop') && ' ' || ' --no-coverage' }}
6276
run : |
63-
USER_ID=$(id -u) GROUP_ID=$(id -g) docker exec prestashop-prestashop-git-1 vendor/bin/phpunit -c modules/ps_apiresources/tests/Integration/phpunit-ci.xml
77+
USER_ID=$(id -u) GROUP_ID=$(id -g) docker exec prestashop-prestashop-git-1 php ${{env.CLI_PHP}} vendor/bin/phpunit -c modules/ps_apiresources/tests/Integration/phpunit-ci.xml${{ env.CLI_PHPUNIT }}
78+
79+
- name: Upload coverage results to Coveralls
80+
if: matrix.php == '8.4' && matrix.prestashop_version == 'develop'
81+
env:
82+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
run: |
84+
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.9.0/php-coveralls.phar
85+
chmod +x php-coveralls.phar
86+
php php-coveralls.phar --coverage_clover=prestashop/modules/ps_apiresources/tests/Integration/clover.xml -vvv

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
.phpunit.result.cache
44
tests/local-parameters/parameters.php
55
tests/local-parameters/parameters.yml
6+
tests/Integration/clover.xml

tests/Integration/phpunit-ci.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,15 @@
1212
<directory>.</directory>
1313
</testsuite>
1414
</testsuites>
15+
<source>
16+
<include>
17+
<directory suffix=".php">../../src</directory>
18+
</include>
19+
</source>
20+
<coverage
21+
includeUncoveredFiles="false">
22+
<report>
23+
<clover outputFile="clover.xml"/>
24+
</report>
25+
</coverage>
1526
</phpunit>

0 commit comments

Comments
 (0)