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"
|
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
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-08-27 18:53:54 +02:00
|
|
|
tools: composer:v2.4
|
2022-04-15 14:35:33 +02:00
|
|
|
extensions: xdebug, mysqli
|
|
|
|
coverage: xdebug
|
2021-10-06 16:23:35 +02:00
|
|
|
- name: "Show Composer version"
|
|
|
|
run: composer --version
|
|
|
|
- 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"
|
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-04-15 14:35:33 +02:00
|
|
|
composer require --no-ansi --no-interaction --no-progress --no-install typo3/minimal:"$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
|
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: |
|
|
|
|
export typo3DatabaseName="typo3";
|
|
|
|
export typo3DatabaseHost="127.0.0.1";
|
|
|
|
export typo3DatabaseUsername="root";
|
|
|
|
export typo3DatabasePassword="root";
|
|
|
|
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 }}
|
|
|
|
run: ./.Build/vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v
|
2021-10-06 16:23:35 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-04-15 14:35:33 +02:00
|
|
|
include:
|
2022-06-15 18:22:18 +02:00
|
|
|
- typo3-version: "^11.5"
|
|
|
|
php-version: "7.4"
|
2022-04-15 14:35:33 +02:00
|
|
|
composer-dependencies: highest
|