2021-10-06 16:23:35 +02:00
|
|
|
---
|
|
|
|
# This GitHub Actions workflow is calculating code coverage of extension and creates a badge for it.
|
|
|
|
name: Code coverage
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
jobs:
|
|
|
|
code-coverage:
|
|
|
|
name: "Calculate code coverage"
|
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
steps:
|
|
|
|
- name: "Checkout"
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: "Install PHP"
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: "${{ matrix.php-version }}"
|
|
|
|
coverage: xdebug
|
|
|
|
extensions: xdebug, mysqli
|
2022-01-02 02:23:40 +01:00
|
|
|
tools: composer:v2.2
|
2021-10-06 16:23:35 +02:00
|
|
|
- name: "Show Composer version"
|
|
|
|
run: composer --version
|
|
|
|
- name: "Cache dependencies installed with composer"
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
key: "php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
|
|
|
|
path: ~/.cache/composer
|
|
|
|
restore-keys: "php${{ matrix.php-version }}-composer-\n"
|
|
|
|
- env:
|
|
|
|
TYPO3: "${{ matrix.typo3-version }}"
|
|
|
|
name: "Install TYPO3 Core"
|
|
|
|
run: |
|
|
|
|
composer require --no-progress typo3/minimal:"$TYPO3"
|
|
|
|
composer show
|
|
|
|
- name: "Start MySQL"
|
|
|
|
run: "sudo /etc/init.d/mysql start"
|
|
|
|
- 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: "Run unit tests with coverage"
|
|
|
|
run: composer ci:coverage:unit
|
|
|
|
- name: "Merge coverage results"
|
|
|
|
run: composer ci:coverage:merge
|
|
|
|
- name: "Generate coverage badge"
|
|
|
|
uses: timkrase/phpunit-coverage-badge@v1.2.0
|
|
|
|
with:
|
|
|
|
report: './coverage/clover.xml'
|
|
|
|
coverage_badge_path: './coverage/badge.svg'
|
|
|
|
- name: "Commit PHPUnit coverage results"
|
|
|
|
uses: s0/git-publish-subdir-action@develop
|
|
|
|
env:
|
|
|
|
REPO: self
|
|
|
|
BRANCH: code-coverage-badge
|
|
|
|
FOLDER: coverage
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
php-version:
|
|
|
|
- 7.4
|
|
|
|
typo3-version:
|
|
|
|
- ^10.4
|