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:
|
2022-10-19 15:14:17 +02:00
|
|
|
permissions:
|
|
|
|
contents: read
|
2021-10-06 16:23:35 +02:00
|
|
|
jobs:
|
|
|
|
code-coverage:
|
|
|
|
name: "Calculate code coverage"
|
2022-10-19 15:14:17 +02:00
|
|
|
permissions:
|
|
|
|
actions: write
|
2024-05-20 22:47:38 +02:00
|
|
|
runs-on: ubuntu-24.04
|
2022-09-21 16:54:21 +02:00
|
|
|
env:
|
|
|
|
DB_DATABASE: typo3
|
|
|
|
DB_USER: root
|
|
|
|
DB_PASSWORD: root
|
|
|
|
DB_HOST: localhost
|
2021-10-06 16:23:35 +02:00
|
|
|
steps:
|
|
|
|
- name: "Checkout"
|
2023-09-04 16:05:19 +02:00
|
|
|
uses: actions/checkout@v4
|
2021-10-06 16:23:35 +02:00
|
|
|
- name: "Install PHP"
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: "${{ matrix.php-version }}"
|
2024-04-04 08:54:49 +02:00
|
|
|
ini-file: development
|
2022-10-18 19:38:45 +02:00
|
|
|
tools: composer:v2, phive
|
|
|
|
extensions: mysqli
|
2024-08-23 14:29:27 +02:00
|
|
|
coverage: xdebug
|
2024-05-07 12:00:35 +02:00
|
|
|
- name: "Install development tools"
|
|
|
|
run: phive --no-progress install --trust-gpg-keys D8406D0D82947747293778314AA394086372C20A
|
2021-10-06 16:23:35 +02:00
|
|
|
- name: "Show Composer version"
|
|
|
|
run: composer --version
|
2024-05-06 06:28:54 +02:00
|
|
|
- name: "Show the Composer configuration"
|
|
|
|
run: composer config --global --list
|
2021-10-06 16:23:35 +02:00
|
|
|
- name: "Cache dependencies installed with composer"
|
2024-01-18 06:51:08 +01:00
|
|
|
uses: actions/cache@v4
|
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"
|
2022-04-12 22:27:14 +02:00
|
|
|
- name: "Install TYPO3 Core"
|
|
|
|
env:
|
2021-10-06 16:23:35 +02:00
|
|
|
TYPO3: "${{ matrix.typo3-version }}"
|
|
|
|
run: |
|
2022-08-28 11:08:47 +02:00
|
|
|
composer require --no-ansi --no-interaction --no-progress --no-install typo3/cms-core:"$TYPO3"
|
2022-04-15 14:35:33 +02:00
|
|
|
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
|
2021-10-06 16:23:35 +02:00
|
|
|
composer show
|
|
|
|
- name: "Start MySQL"
|
|
|
|
run: "sudo /etc/init.d/mysql start"
|
2022-04-14 18:13:33 +02:00
|
|
|
- name: "Run unit tests with coverage"
|
|
|
|
run: composer ci:coverage:unit
|
2024-05-06 06:28:54 +02:00
|
|
|
- name: "Show generated coverage files"
|
2024-09-06 07:23:29 +02:00
|
|
|
run: "ls -lahR build/coverage/"
|
2021-10-06 16:23:35 +02:00
|
|
|
- name: "Run functional tests with coverage"
|
|
|
|
run: |
|
2022-09-21 16:54:21 +02:00
|
|
|
export typo3DatabaseName="$DB_DATABASE";
|
|
|
|
export typo3DatabaseHost="$DB_HOST";
|
|
|
|
export typo3DatabaseUsername="$DB_USER";
|
|
|
|
export typo3DatabasePassword="$DB_PASSWORD";
|
2021-10-06 16:23:35 +02:00
|
|
|
composer ci:coverage:functional
|
2024-05-06 06:28:54 +02:00
|
|
|
- name: "Show generated coverage files"
|
2024-09-06 07:23:29 +02:00
|
|
|
run: "ls -lahR build/coverage/"
|
2021-10-06 16:23:35 +02:00
|
|
|
- name: "Merge coverage results"
|
|
|
|
run: composer ci:coverage:merge
|
2024-09-02 19:05:19 +02:00
|
|
|
- name: "Show combined coverage files"
|
|
|
|
run: "ls -lahR build/logs/"
|
2022-04-15 18:47:18 +02:00
|
|
|
- name: "Upload coverage results to Coveralls"
|
2024-09-02 19:05:19 +02:00
|
|
|
uses: coverallsapp/github-action@v2
|
2021-10-06 16:23:35 +02:00
|
|
|
env:
|
2024-09-02 19:05:19 +02:00
|
|
|
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
|
2021-10-06 16:23:35 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-04-15 14:35:33 +02:00
|
|
|
include:
|
2023-12-27 13:45:30 +01:00
|
|
|
- typo3-version: "^12.4"
|
|
|
|
php-version: "8.3"
|
2022-04-15 14:35:33 +02:00
|
|
|
composer-dependencies: highest
|