mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-09-20 01:36:14 +02:00
tea/.github/workflows/codecoverage.yml
Sybille Peters eb909406fe
[TASK] Unify web-dir, bin-dir (#807)
The following are changed:

- web-dir: ".Build/public" => ".Build/Web"
- bin-dir: not specified, defaulted to .Build/vendor/bin
  => ".Build/bin"

The vendor-dir was alreaday ".Build/vendor" and is left
unchanged.

Since the above paths may be used in scripts, composer.json,
build pipelines, configuration etc. it facilitates
contribution across various extensions (and the core) if
the same defaults are used.

The goal of patches related to #802 is to unify the paths
across TYPO3 extensions, specifically focusing on the
"official" extensions (such as tea, Documentation examples
extension etc.).

- .Build has already been well established (and is used by
"tea" as well.
- web-dir (".Build/Web") is currently not used consistently
  (across official extensions). Either ".Build/public", ".Build/Web"
  or ".Build/web" or "public" is used. We use ".Build/Web"
  now as that is already well established in "styleguide"
  and other extensions. (This choice is not better than
  the other, but is more commonly used and has led to a
  consensus in preliminary decision making process.)
- bin-dir: Here ".Build/bin" is mostly used (if defined at all)
- vendor-dir: Here ".Build/vendor" is mostly used (if defined
  at all)

Related: #802
2023-04-11 10:24:24 +02:00

80 lines
2.9 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:
permissions:
contents: read
jobs:
code-coverage:
name: "Calculate code coverage"
permissions:
actions: write
runs-on: ubuntu-22.04
env:
DB_DATABASE: typo3
DB_USER: root
DB_PASSWORD: root
DB_HOST: localhost
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
tools: composer:v2, phive
extensions: mysqli
coverage: pcov
ini-values: pcov.directory=Classes
- name: "Show Composer version"
run: composer --version
- 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 TYPO3 Core"
env:
TYPO3: "${{ matrix.typo3-version }}"
run: |
composer require --no-ansi --no-interaction --no-progress --no-install typo3/cms-core:"$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
composer show
- name: "Start MySQL"
run: "sudo /etc/init.d/mysql start"
- name: "Run unit tests with coverage"
run: composer ci:coverage:unit
- name: "Run functional tests with coverage"
run: |
export typo3DatabaseName="$DB_DATABASE";
export typo3DatabaseHost="$DB_HOST";
export typo3DatabaseUsername="$DB_USER";
export typo3DatabasePassword="$DB_PASSWORD";
composer ci:coverage:functional
- name: "Merge coverage results"
run: composer ci:coverage:merge
- name: "Upload coverage results to Coveralls"
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./.Build/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.5"
php-version: "7.4"
composer-dependencies: highest