mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-15 22:16:13 +01:00
tea/.github/workflows/codecoverage.yml
Stefan Bürk d0282d488a [TASK] Migrate GitHub Actions to use Build/Scripts/runTests.sh
This change migrates the GitHub Action workflows to use the
`runTests.sh` wrapper. Thus making it easy reproduciable locally
and have the exact same environment and workflow which ease
debugging on pipeline failures.

Functional database matrix may be increased in a dedicated follow-up
change and is avoided for now.

Note: composer normalize check is temporarly disabled, due how runTests.sh
      are handling composer.json changes. composer.json is reverted, thus
      composer.lock not matching composer.json. Good solution for this has
      to be searched.
2022-10-16 05:08:57 +02:00

59 lines
3.3 KiB
YAML

---
# This GitHub Actions workflow calculates the code coverage of the extension and uploads it to coveralls.io.
name: Code coverage
on:
push:
branches:
- main
pull_request:
jobs:
code-coverage:
name: "Calculate code coverage"
runs-on: ubuntu-22.04
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
tools: composer:v2.4
extensions: xdebug, mysqli
coverage: xdebug
- name: "Set composer token"
run: "Build/Scripts/runTests.sh -p ${{ matrix.php-version }} -s composer -e 'config github-oauth.github.com ${{ github.token }}'"
- name: "Show Composer version"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e '--version'"
- name: "Show the Composer configuration"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e 'config --global --list'"
- name: "Cache dependencies installed with composer"
uses: actions/cache@v3
with:
key: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-${{ hashFiles('**/composer.json') }}"
path: ~/.cache/composer
restore-keys: "php${{ matrix.php-version }}-typo3${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-\n"
- name: "Install lowest dependencies with composer"
if: "matrix.composer-dependencies == 'lowest'"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composerInstallLowest"
- name: "Install highest dependencies with composer"
if: "matrix.composer-dependencies == 'highest'"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composerInstallHighest"
- name: "Create coverage directory structure"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e 'coverage:create-directories'"
- name: "Run unit tests with coverage"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s unit -x -z 'coverage' -e '--whitelist Classes --coverage-php=.Build/coverage/unit.cov'"
- name: "Run functional tests with coverage"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d mysql -a mysqli -j 8.0 -x -z 'coverage' -e '--whitelist Classes --coverage-php=.Build/coverage/functional.cov'"
- name: "Merge coverage results"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e 'ci:coverage:merge'"
- name: "Upload coverage results to Coveralls"
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./.Build/vendor/bin/php-coveralls --coverage_clover=./.Build/logs/clover.xml --json_path=./.Build/logs/coveralls-upload.json -v
strategy:
fail-fast: false
matrix:
include:
- typo3-version: "11"
php-version: "7.4"
composer-dependencies: highest