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
|
2022-09-21 16:54:21 +02:00
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
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 }}"
|
2022-10-18 19:38:45 +02:00
|
|
|
tools: composer:v2, phive
|
|
|
|
extensions: mysqli
|
|
|
|
coverage: pcov
|
|
|
|
ini-values: pcov.directory=Classes
|
2021-10-06 16:23:35 +02:00
|
|
|
- name: "Show Composer version"
|
|
|
|
run: composer --version
|
|
|
|
- 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
|
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
|
|
|
|
- name: "Merge coverage results"
|
|
|
|
run: composer 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 }}
|
2023-04-11 10:24:24 +02:00
|
|
|
run: ./.Build/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:
|
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
|