mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-22 09:56:13 +01:00
tea/.github/workflows/codecoverage.yml
Oliver Klee a0fa00564c
[TASK] Unify the coverage-related directories (#1450)
As we'll need to have `build/logs/` for the merged coverage data
anyway, there is no point to have the separate coverage files
in `.Build/coverage/` instead of in `build/coverage/`.

Now the setup is more consistent.

Please note that this only affects the CI builds as we usually
only collect coverage data there for the pull requests.
2024-09-06 07:23:29 +02:00

93 lines
3.5 KiB
YAML

---
# This GitHub Actions workflow calculates the code coverage of the extension and uploads it to coveralls.io.
name: Code coverage
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
code-coverage:
name: "Calculate code coverage"
permissions:
actions: write
runs-on: ubuntu-24.04
env:
DB_DATABASE: typo3
DB_USER: root
DB_PASSWORD: root
DB_HOST: localhost
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
ini-file: development
tools: composer:v2, phive
extensions: mysqli
coverage: xdebug
- name: "Install development tools"
run: phive --no-progress install --trust-gpg-keys D8406D0D82947747293778314AA394086372C20A
- name: "Show Composer version"
run: composer --version
- name: "Show the Composer configuration"
run: composer config --global --list
- name: "Cache dependencies installed with composer"
uses: actions/cache@v4
with:
key: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-${{ hashFiles('**/composer.json') }}"
path: ~/.cache/composer
restore-keys: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-\n"
- name: "Install TYPO3 Core"
env:
TYPO3: "${{ matrix.typo3-version }}"
run: |
composer require --no-ansi --no-interaction --no-progress --no-install typo3/cms-core:"$TYPO3"
composer show
- name: "Install lowest dependencies with composer"
if: "matrix.composer-dependencies == 'lowest'"
run: |
composer update --no-ansi --no-interaction --no-progress --with-dependencies --prefer-lowest
composer show
- name: "Install highest dependencies with composer"
if: "matrix.composer-dependencies == 'highest'"
run: |
composer update --no-ansi --no-interaction --no-progress --with-dependencies
composer show
- name: "Start MySQL"
run: "sudo /etc/init.d/mysql start"
- name: "Run unit tests with coverage"
run: composer ci:coverage:unit
- name: "Show generated coverage files"
run: "ls -lahR build/coverage/"
- name: "Run functional tests with coverage"
run: |
export typo3DatabaseName="$DB_DATABASE";
export typo3DatabaseHost="$DB_HOST";
export typo3DatabaseUsername="$DB_USER";
export typo3DatabasePassword="$DB_PASSWORD";
composer ci:coverage:functional
- name: "Show generated coverage files"
run: "ls -lahR build/coverage/"
- name: "Merge coverage results"
run: composer ci:coverage:merge
- name: "Show combined coverage files"
run: "ls -lahR build/logs/"
- name: "Upload coverage results to Coveralls"
uses: coverallsapp/github-action@v2
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
# Note: This is the only path that the Coveralls GitHub Action supports.
# So we cannot use something like .Build/coverage/clover.xml here.
file: build/logs/clover.xml
strategy:
fail-fast: false
matrix:
include:
- typo3-version: "^12.4"
php-version: "8.3"
composer-dependencies: highest