Skip to content

Commit

Permalink
Fix coverage files paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Sieg committed Oct 2, 2023
1 parent 47d7629 commit c367904
Showing 1 changed file with 70 additions and 8 deletions.
78 changes: 70 additions & 8 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ jobs:
path: |
source/test-module/phpstan.report.json
unit_integration_tests:
unit_tests:
needs: [ install_shop_with_module ]
runs-on: ubuntu-latest
steps:
Expand All @@ -243,16 +243,62 @@ jobs:
-e XDEBUG_MODE=coverage \
--workdir=/var/www/test-module \
php composer phpunit -- \
--testsuite=Unit \
--coverage-text \
--coverage-clover=/var/www/coverage.xml
--coverage-clover=/var/www/unit.xml
- name: Upload log artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: ModuleUnitTestsLog-${{ inputs.php }}-${{ inputs.mysql }}
path: |
source/unit.xml
source/source/log/oxideshop.log
data/php/logs/error_log.txt
- name: Stop containers
if: always()
run: |
docker-compose down
sleep 2
integration_tests:
needs: [ install_shop_with_module ]
runs-on: ubuntu-latest
steps:
- name: Load current installation from cache
uses: actions/cache@v3
with:
path: |
./*
key: installation-${{ github.sha }}-${{ join(inputs.*, '-') }}-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: |
installation-${{ github.sha }}-${{ join(inputs.*, '-') }}-${{ github.run_number }}-${{ github.run_attempt }}
installation-${{ github.sha }}-${{ join(inputs.*, '-') }}-${{ github.run_number }}
- name: Start containers
run: |
make up
sleep 2
- name: Run tests
run: |
docker-compose exec -T \
-e XDEBUG_MODE=coverage \
--workdir=/var/www/test-module \
php composer phpunit -- \
--testsuite=Integration \
--coverage-text \
--coverage-clover=/var/www/integration.xml
- name: Upload log artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: ModuleIntegrationTestsLog-${{ inputs.php }}-${{ inputs.mysql }}
path: |
source/coverage.xml
source/integration.xml
source/source/log/oxideshop.log
data/php/logs/error_log.txt
Expand Down Expand Up @@ -315,24 +361,40 @@ jobs:
sleep 2
sonarcloud:
needs: [ unit_integration_tests ]
needs: [ unit_tests, integration_tests ]
if: ${{ always() && inputs.report_sonarcloud }}
runs-on: ubuntu-latest
steps:
- name: Checkout current module
uses: actions/checkout@v4

- name: Download TestsLog artifacts
- name: Download Integration artifacts
continue-on-error: true
uses: actions/download-artifact@v3
with:
name: ModuleIntegrationTestsLog-${{ inputs.php }}-${{ inputs.mysql }}
path: ./
path: ./coverage/

- name: Download Unit artifacts
continue-on-error: true
uses: actions/download-artifact@v3
with:
name: ModuleUnitTestsLog-${{ inputs.php }}-${{ inputs.mysql }}
path: ./coverage/

- name: List everything
if: always()
run: |
cd coverage
ls -alh
cd source
ls -alh
- name: Fix coverage paths
if: always()
run: |
sed -i 's+/var/www/test-module/+./+' source/coverage.xml
sed -i 's+/var/www/test-module/+./+' coverage/source/unit.xml
sed -i 's+/var/www/test-module/+./+' coverage/source/integration.xml
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
Expand All @@ -346,6 +408,6 @@ jobs:
-Dsonar.sources=src
-Dsonar.tests=tests
-Dsonar.sourceEncoding=UTF-8
-Dsonar.php.coverage.reportPaths=source/coverage.xml
-Dsonar.php.coverage.reportPaths=coverage/source/unit.xml,coverage/source/integration.xml
-Dsonar.cpd.php.minimumTokens=25
-Dsonar.cpd.php.minimumLines=5

0 comments on commit c367904

Please sign in to comment.