2021-10-06 16:23:35 +02:00
|
|
|
---
|
2022-04-15 18:47:18 +02:00
|
|
|
# This GitHub Actions workflow calculates the code coverage of the extension and uploads it to coveralls.io.
|
2021-10-06 16:23:35 +02:00
|
|
|
name: Code coverage
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2022-04-15 18:47:18 +02:00
|
|
|
pull_request:
|
2021-10-06 16:23:35 +02:00
|
|
|
jobs:
|
|
|
|
code-coverage:
|
|
|
|
name: "Calculate code coverage"
|
2022-09-21 16:54:21 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2021-10-06 16:23:35 +02:00
|
|
|
steps:
|
|
|
|
- name: "Checkout"
|
2022-03-22 17:57:39 +01:00
|
|
|
uses: actions/checkout@v3
|
2021-10-06 16:23:35 +02:00
|
|
|
- name: "Install PHP"
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: "${{ matrix.php-version }}"
|
2022-04-15 14:35:33 +02:00
|
|
|
extensions: xdebug, mysqli
|
|
|
|
coverage: xdebug
|
2022-10-16 02:10:20 +02:00
|
|
|
- name: "Set composer token"
|
|
|
|
run: "Build/Scripts/runTests.sh -p ${{ matrix.php-version }} -s composer -e 'config github-oauth.github.com ${{ github.token }}'"
|
2021-10-06 16:23:35 +02:00
|
|
|
- name: "Show Composer version"
|
2022-10-16 02:10:20 +02:00
|
|
|
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e '--version'"
|
|
|
|
- name: "Show the Composer configuration"
|
|
|
|
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e 'config --global --list'"
|
2021-10-06 16:23:35 +02:00
|
|
|
- name: "Cache dependencies installed with composer"
|
2022-04-03 02:26:04 +02:00
|
|
|
uses: actions/cache@v3
|
2021-10-06 16:23:35 +02:00
|
|
|
with:
|
2022-04-15 14:35:33 +02:00
|
|
|
key: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-${{ hashFiles('**/composer.json') }}"
|
2021-10-06 16:23:35 +02:00
|
|
|
path: ~/.cache/composer
|
2022-04-15 14:35:33 +02:00
|
|
|
restore-keys: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-\n"
|
|
|
|
- name: "Install lowest dependencies with composer"
|
|
|
|
if: "matrix.composer-dependencies == 'lowest'"
|
2022-10-16 02:10:20 +02:00
|
|
|
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composerInstallLowest"
|
2022-04-15 14:35:33 +02:00
|
|
|
- name: "Install highest dependencies with composer"
|
|
|
|
if: "matrix.composer-dependencies == 'highest'"
|
2022-10-16 02:10:20 +02:00
|
|
|
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composerInstallHighest"
|
|
|
|
- name: "Create coverage directory structure"
|
|
|
|
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e 'coverage:create-directories'"
|
2022-04-14 18:13:33 +02:00
|
|
|
- name: "Run unit tests with coverage"
|
2022-10-16 02:10:20 +02:00
|
|
|
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s unit -x -z 'coverage' -e '--whitelist Classes --coverage-php=.Build/coverage/unit.cov'"
|
2021-10-06 16:23:35 +02:00
|
|
|
- name: "Run functional tests with coverage"
|
2022-10-16 02:10:20 +02:00
|
|
|
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d mysql -a mysqli -j 8.0 -x -z 'coverage' -e '--whitelist Classes --coverage-php=.Build/coverage/functional.cov'"
|
2021-10-06 16:23:35 +02:00
|
|
|
- name: "Merge coverage results"
|
2022-10-16 02:10:20 +02:00
|
|
|
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e 'ci:coverage:merge'"
|
2022-04-15 18:47:18 +02:00
|
|
|
- name: "Upload coverage results to Coveralls"
|
2021-10-06 16:23:35 +02:00
|
|
|
env:
|
2022-04-15 18:47:18 +02:00
|
|
|
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2022-10-15 21:24:00 +02:00
|
|
|
run: ./.Build/vendor/bin/php-coveralls --coverage_clover=./.Build/logs/clover.xml --json_path=./.Build/logs/coveralls-upload.json -v
|
2021-10-06 16:23:35 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-04-15 14:35:33 +02:00
|
|
|
include:
|
2022-10-16 02:10:20 +02:00
|
|
|
- typo3-version: "11"
|
2022-06-15 18:22:18 +02:00
|
|
|
php-version: "7.4"
|
2022-04-15 14:35:33 +02:00
|
|
|
composer-dependencies: highest
|