mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-15 21:16:12 +01:00
tea/.github/workflows/ci.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

229 lines
11 KiB
YAML

---
# This GitHub Actions workflow uses the same development tools that are also installed locally
# via Composer or PHIVE and calls them using the Composer scripts.
name: CI with Composer scripts
on:
push:
branches:
- main
pull_request:
schedule:
- cron: '15 3 * * 1'
jobs:
php-lint:
name: "PHP linter"
runs-on: ubuntu-22.04
steps:
- name: "Checkout"
uses: actions/checkout@v3
- 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 the Composer configuration"
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s composer -e 'config --global --list'"
- name: "Run PHP lint"
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s composer -e 'ci:php:lint'"
strategy:
fail-fast: false
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
code-quality:
name: "Code quality checks"
runs-on: ubuntu-22.04
steps:
- name: "Checkout"
uses: actions/checkout@v3
- 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 11 -p ${{ matrix.php-version }} -s composer -e '--version'"
- name: "Show the Composer configuration"
run: "Build/Scripts/runTests.sh -t 11 -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 }}-composer-${{ hashFiles('**/composer.json') }}"
path: ~/.cache/composer
restore-keys: "php${{ matrix.php-version }}-composer-\n"
- name: "Install Composer dependencies"
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s composerInstall"
- name: "Run command"
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s composer -e 'ci:${{ matrix.command }}'"
strategy:
fail-fast: false
matrix:
command:
# @todo disabled composer:normalize temporarly, as this does not work out due composer.json <-> lock
# discrepancy with keep json file unchanged logic of runTests.sh. Does this tests make sense for
# extension/package development as this does not have fixed composer.lock files, thus always having
# valid composer.json <-> lock if not proceeded like runTests.sh ?
# - "composer:normalize"
- "json:lint"
- "php:copypaste"
- "php:cs-fixer"
- "php:sniff"
- "php:stan"
- "ts:lint"
- "yaml:lint"
php-version:
- "8.1"
code-quality-frontend:
name: "Code quality frontend checks"
runs-on: ubuntu-22.04
env:
GITHUB_COMPOSER_TOKEN: ${{ github.token }}
strategy:
fail-fast: false
matrix:
command:
- "style"
- "js"
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Install modules"
run: yarn
- name: "Run command"
run: "yarn lint:${{ matrix.command }}"
xliff-lint:
name: "Xliff linter"
runs-on: ubuntu-22.04
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Run the xliff lint"
uses: TYPO3-Continuous-Integration/TYPO3-CI-Xliff-Lint@v1
unit-tests:
name: "Unit tests"
runs-on: ubuntu-22.04
needs: php-lint
steps:
- name: "Checkout"
uses: actions/checkout@v3
- 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: "Run unit tests"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s unit"
strategy:
fail-fast: false
matrix:
include:
- typo3-version: "11"
php-version: "7.4"
composer-dependencies: lowest
- typo3-version: "11"
php-version: "7.4"
composer-dependencies: highest
- typo3-version: "11"
php-version: "8.0"
composer-dependencies: lowest
- typo3-version: "11"
php-version: "8.0"
composer-dependencies: highest
- typo3-version: "11"
php-version: "8.1"
composer-dependencies: lowest
- typo3-version: "11"
php-version: "8.1"
composer-dependencies: highest
- typo3-version: "12"
php-version: "8.1"
composer-dependencies: lowest
- typo3-version: "12"
php-version: "8.1"
composer-dependencies: highest
functional-tests:
name: "Functional tests"
runs-on: ubuntu-22.04
needs: php-lint
steps:
- name: "Checkout"
uses: actions/checkout@v3
- 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: "Set composer token"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s composer -e 'config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}'"
- 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: "Run functional tests (sqlite)"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d sqlite"
- name: "Run functional tests (MySQL 5.5 mysqli)"
if: "matrix.typo3-version == '11'"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d mysql -a mysqli -j 5.5"
# TYPO3v12 has min requirement MySQL 8.0, so use this for minimum test compared to TYPO3v11 testing (MySQL 5.5) with mysqli
- name: "Run functional tests (MySQL 8.0 mysqli)"
if: "matrix.typo3-version == '12'"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d mysql -a mysqli -j 5.5"
- name: "Run functional tests (MySQL 8.0 pdo_mysql)"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d mysql -a pdo_mysql -j 8.0"
- name: "Run functional tests (MariaDB 10.2 mysqli)"
if: "matrix.typo3-version == '11'"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d mariadb -a mysqli -i 10.2"
# TYPO3v12 has min requirement MariaDB 10.3, so use this for minimum test compared to TYPO3v11 testing (MariaDB 10.2)
- name: "Run functional tests (MariaDB 10.3 mysqli)"
if: "matrix.typo3-version == '12'"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d mariadb -a mysqli -i 10.3"
- name: "Run functional tests (MariaDB 10.7 pdo_mysql)"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d mariadb -a pdo_mysql -i 10.7"
- name: "Run functional tests (PostgresSQL 10)"
run: "Build/Scripts/runTests.sh -t ${{ matrix.typo3-version }} -p ${{ matrix.php-version }} -s functional -d postgres -k 10"
strategy:
fail-fast: false
matrix:
include:
- typo3-version: "11"
php-version: "7.4"
composer-dependencies: lowest
- typo3-version: "11"
php-version: "7.4"
composer-dependencies: highest
- typo3-version: "11"
php-version: "8.0"
composer-dependencies: lowest
- typo3-version: "11"
php-version: "8.0"
composer-dependencies: highest
- typo3-version: "11"
php-version: "8.1"
composer-dependencies: lowest
- typo3-version: "11"
php-version: "8.1"
composer-dependencies: highest
- typo3-version: "12"
php-version: "8.1"
composer-dependencies: lowest
- typo3-version: "12"
php-version: "8.1"
composer-dependencies: highest