mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-09-20 07:16:16 +02:00
tea/.github/workflows/codecoverage.yml
Oliver Klee 6b98478f58
[TASK] Make the Composer caches on CI more fine-grained (#393)
The installed Composer packages will be different depending on the
major TYPO3 version being tested and on the strategy for the
dependencies (highest, lowest). So it makes sense to have
separate Composer caches for these versions in order to avoid
cache misses.
2022-02-24 16:41:34 +01:00

67 lines
2.2 KiB
YAML

---
# 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
tools: composer:v2.2
- name: "Show Composer version"
run: composer --version
- name: "Cache dependencies installed with composer"
uses: actions/cache@v1
with:
key: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-composer-${{ hashFiles('**/composer.json') }}"
path: ~/.cache/composer
restore-keys: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-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