Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Introduce GitHub actions powered workflow #147

Merged
merged 10 commits into from
Mar 15, 2023
Merged
20 changes: 0 additions & 20 deletions .config/phpstan.neon

This file was deleted.

2 changes: 1 addition & 1 deletion .ddev/commands/web/run-tests
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ done

prepare_test_instance() {
echo "Instantiating TYPO3 v${currentVersion} for Test"
bash ./.ddev/scripts/update_version.sh $currentVersion
bash ./Build/Scripts/composer-for-core-version.sh $currentVersion
}

run_functional() {
Expand Down
2 changes: 1 addition & 1 deletion .ddev/commands/web/update-to
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
## Example: "ddev update-to 9"
## ProjectTypes: typo3

bash ./.ddev/scripts/update_version.sh $*
bash ./Build/Scripts/composer-for-core-version.sh $*
1 change: 1 addition & 0 deletions .ddev/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ web_environment:
- typo3DatabaseUsername=root
nodejs_version: "16"
host_db_port: "59021"
DEEPL_API_KEY: ""

# Key features of ddev's config.yaml:

Expand Down
23 changes: 23 additions & 0 deletions .ddev/docker-compose.deeplmockserver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: '3.6'

services:
# This is the service name used when running ddev commands accepting the
# --service flag.
#
# Based on https://github.com/DeepLcom/deepl-mock build as public image by Stefan Bürk <stefan@buerk.tech>.
deeplmockserver:
# This is the name of the container. It is recommended to follow the same
# name convention used in the main docker-compose.yml file.
container_name: ddev-${DDEV_SITENAME}-deeplmockserver
image: sbuerk/sbuerk-testing-deeplapimockserver:latest
# These labels ensure this service is discoverable by ddev.
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.approot: $DDEV_APPROOT

# Ensure that mockserver is started and have connection to the web service.
web:
depends_on:
- deeplmockserver
links:
- deeplmockserver:deeplmockserver
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
/.github export-ignore
/.vscode export-ignore
/.Build export-ignore
/Build/ export-ignore
/Tests/ export-ignore

# Files
.editorconfig export-ignore
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/testcore10.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: tests core 10

on:
push:
pull_request:
schedule:
- cron: '56 4 * * *'

jobs:
code-quality:
name: "code quality with core v10"
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php-version: [ '7.4']
steps:
- name: "Checkout"
uses: actions/checkout@v3

- name: "Prepare dependencies for TYPO3 v10"
run: "Build/Scripts/runTests.sh -t 10 -p ${{ matrix.php-version }} -s composerUpdate"

- name: "Run TypoScript lint"
run: "Build/Scripts/runTests.sh -t 10 -p ${{ matrix.php-version }} -s lintTypoScript"

- name: "Run PHP lint"
run: "Build/Scripts/runTests.sh -t 10 -p ${{ matrix.php-version }} -s lintPhp"

- name: "Validate CGL"
run: "Build/Scripts/runTests.sh -t 10 -p ${{ matrix.php-version }} -s cgl"

- name: "Ensure tests methods do not start with \"test\""
run: "Build/Scripts/runTests.sh -t 10 -p ${{ matrix.php-version }} -s checkTestMethodsPrefix"

- name: "Ensure UTF-8 files do not contain BOM"
run: "Build/Scripts/runTests.sh -t 10 -p ${{ matrix.php-version }} -s checkBom"

- name: "Test .rst files for integrity"
run: "Build/Scripts/runTests.sh -t 10 -p ${{ matrix.php-version }} -s checkRst"

- name: "Find duplicate exception codes"
run: "Build/Scripts/runTests.sh -t 10 -p ${{ matrix.php-version }} -s checkExceptionCodes"

# @todo Disabled because of PHPStan errors - tricky to handle properly against wide range of core versions. Tackle
# after branching and minimizing version range.
# - name: "Run PHPStan"
# run: "composer analyze:php"

testsuite:
name: all tests with core v10
runs-on: ubuntu-22.04
needs: code-quality
strategy:
fail-fast: false
matrix:
php-version: [ '7.4']
steps:
- name: "Checkout"
uses: actions/checkout@v3

- name: "Prepare dependencies for TYPO3 v10"
run: "Build/Scripts/runTests.sh -t 10 -p ${{ matrix.php-version }} -s composerUpdate"

- name: "Unit"
run: "Build/Scripts/runTests.sh -t 10 -p ${{ matrix.php-version }} -s unit"

# @todo SQLite disabled. Before PHP8.1 SQLite did not returned integer as integers, test cases needs sanitizing for this.
# - name: "Functional SQLite"
# run: "Build/Scripts/runTests.sh -t 10 -p ${{ matrix.php-version }} -s functional -d sqlite"

- name: "Functional MariaDB 10.5 mysqli"
run: "Build/Scripts/runTests.sh -t 10 -p ${{ matrix.php-version }} -s functional -d mariadb -a mysqli"

- name: "Functional MariaDB 10.5 pdo_mysql"
run: "Build/Scripts/runTests.sh -t 10 -p ${{ matrix.php-version }} -s functional -d mariadb -a pdo_mysql"

- name: "Functional MySQL 8.0 mysqli"
run: "Build/Scripts/runTests.sh -t 10 -p ${{ matrix.php-version }} -s functional -d mariadb -a mysqli"

- name: "Functional MySQL 8.0 pdo_mysql"
run: "Build/Scripts/runTests.sh -t 10 -p ${{ matrix.php-version }} -s functional -d mariadb -a pdo_mysql"

# @todo nimut/testing-framework sets sql_mode, which is invalid for postgres. Thus disabling until moved to typo3/testing-framework
# - name: "Functional PostgresSQL 10"
# run: "Build/Scripts/runTests.sh -t 10 -p ${{ matrix.php-version }} -s functional -d postgres"
86 changes: 86 additions & 0 deletions .github/workflows/testcore11.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: tests core 11

on:
push:
pull_request:
schedule:
- cron: '56 4 * * *'

jobs:
code-quality:
name: "code quality with core v11"
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php-version: [ '7.4']
steps:
- name: "Checkout"
uses: actions/checkout@v3

- name: "Prepare dependencies for TYPO3 v11"
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s composerUpdate"

- name: "Run TypoScript lint"
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s lintTypoScript"

- name: "Run PHP lint"
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s lintPhp"

- name: "Validate CGL"
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s cgl"

- name: "Ensure tests methods do not start with \"test\""
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s checkTestMethodsPrefix"

- name: "Ensure UTF-8 files do not contain BOM"
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s checkBom"

- name: "Test .rst files for integrity"
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s checkRst"

- name: "Find duplicate exception codes"
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s checkExceptionCodes"

# @todo Disabled because of PHPStan errors - tricky to handle properly against wide range of core versions. Tackle
# after branching and minimizing version range.
# - name: "Run PHPStan"
# run: "composer analyze:php"

testsuite:
name: all tests with core v11
runs-on: ubuntu-22.04
needs: code-quality
strategy:
fail-fast: false
matrix:
php-version: [ '7.4', '8.0', '8.1', '8.2' ]
steps:
- name: "Checkout"
uses: actions/checkout@v3

- name: "Prepare dependencies for TYPO3 v11"
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s composerUpdate"

- name: "Unit"
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s unit"

# @todo SQLite disabled. Before PHP8.1 SQLite did not returned integer as integers, test cases needs sanitizing for this.
# - name: "Functional SQLite"
# run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s functional -d sqlite"

- name: "Functional MariaDB 10.5 mysqli"
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s functional -d mariadb -a mysqli"

- name: "Functional MariaDB 10.5 pdo_mysql"
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s functional -d mariadb -a pdo_mysql"

- name: "Functional MySQL 8.0 mysqli"
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s functional -d mariadb -a mysqli"

- name: "Functional MySQL 8.0 pdo_mysql"
run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s functional -d mariadb -a pdo_mysql"

# @todo nimut/testing-framework sets sql_mode, which is invalid for postgres. Thus disabling until moved to typo3/testing-framework
# - name: "Functional PostgresSQL 10"
# run: "Build/Scripts/runTests.sh -t 11 -p ${{ matrix.php-version }} -s functional -d postgres"
87 changes: 87 additions & 0 deletions .github/workflows/testcore9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: tests core 9

# @todo v9 disabled, due multiple out-of-sync dependencies (news to high for core v9) and other issues
on:
push:
pull_request:
schedule:
- cron: '56 4 * * *'

jobs:
code-quality:
name: "code quality with core v9"
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php-version: [ '7.4']
steps:
- name: "Checkout"
uses: actions/checkout@v3

- name: "Prepare dependencies for TYPO3 v9"
run: "Build/Scripts/runTests.sh -t 9 -p ${{ matrix.php-version }} -s composerUpdate"

- name: "Run TypoScript lint"
run: "Build/Scripts/runTests.sh -t 9 -p ${{ matrix.php-version }} -s lintTypoScript"

- name: "Run PHP lint"
run: "Build/Scripts/runTests.sh -t 9 -p ${{ matrix.php-version }} -s lintPhp"

- name: "Validate CGL"
run: "Build/Scripts/runTests.sh -t 9 -p ${{ matrix.php-version }} -s cgl"

- name: "Ensure tests methods do not start with \"test\""
run: "Build/Scripts/runTests.sh -t 9 -p ${{ matrix.php-version }} -s checkTestMethodsPrefix"

- name: "Ensure UTF-8 files do not contain BOM"
run: "Build/Scripts/runTests.sh -t 9 -p ${{ matrix.php-version }} -s checkBom"

- name: "Test .rst files for integrity"
run: "Build/Scripts/runTests.sh -t 9 -p ${{ matrix.php-version }} -s checkRst"

- name: "Find duplicate exception codes"
run: "Build/Scripts/runTests.sh -t 9 -p ${{ matrix.php-version }} -s checkExceptionCodes"

# @todo Disabled because of PHPStan errors - tricky to handle properly against wide range of core versions. Tackle
# after branching and minimizing version range.
# - name: "Run PHPStan"
# run: "composer analyze:php"

testsuite:
name: all tests with core v9
runs-on: ubuntu-22.04
needs: code-quality
strategy:
fail-fast: false
matrix:
php-version: [ '7.4']
steps:
- name: "Checkout"
uses: actions/checkout@v3

- name: "Prepare dependencies for TYPO3 v9"
run: "Build/Scripts/runTests.sh -t 9 -p ${{ matrix.php-version }} -s composerUpdate"

- name: "Unit"
run: "Build/Scripts/runTests.sh -t 9 -p ${{ matrix.php-version }} -s unit"

# @todo SQLite disabled. Before PHP8.1 SQLite did not returned integer as integers, test cases needs sanitizing for this.
# - name: "Functional SQLite"
# run: "Build/Scripts/runTests.sh -t 9 -p ${{ matrix.php-version }} -s functional -d sqlite"

- name: "Functional MariaDB 10.5 mysqli"
run: "Build/Scripts/runTests.sh -t 9 -p ${{ matrix.php-version }} -s functional -d mariadb -a mysqli"

- name: "Functional MariaDB 10.5 pdo_mysql"
run: "Build/Scripts/runTests.sh -t 9 -p ${{ matrix.php-version }} -s functional -d mariadb -a pdo_mysql"

- name: "Functional MySQL 8.0 mysqli"
run: "Build/Scripts/runTests.sh -t 9 -p ${{ matrix.php-version }} -s functional -d mariadb -a mysqli"

- name: "Functional MySQL 8.0 pdo_mysql"
run: "Build/Scripts/runTests.sh -t 9 -p ${{ matrix.php-version }} -s functional -d mariadb -a pdo_mysql"

# @todo nimut/testing-framework sets sql_mode, which is invalid for postgres. Thus disabling until moved to typo3/testing-framework
# - name: "Functional PostgresSQL 10"
# run: "Build/Scripts/runTests.sh -t 9 -p ${{ matrix.php-version }} -s functional -d postgres"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
!.Build/Web/.gitkeep
.ddev/docker-compose.tempfs.yaml
composer.lock
composer.json.testing
*.cache
var
.php-cs-fixer.cache
Expand All @@ -12,3 +13,4 @@ var
/*.http
http-client.env.json
/.test-results
Build/testing-docker/.env
25 changes: 25 additions & 0 deletions Build/Scripts/checkUtf8Bom.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

#########################
#
# Check all UTF-8 files do not contain BOM.
#
# It expects to be run from the core root.
#
##########################

FILES=`find . -type f \
! -path "./.Build/*" \
! -path "./.git/*" \
! -path "./.php_cs.cache" \
! -path "./.php-cs-fixer.cache" \
! -path "./Documentation-GENERATED-temp/*" \
-print0 | xargs -0 -n1 -P8 file {} | grep 'UTF-8 Unicode (with BOM)'`

if [ -n "${FILES}" ]; then
echo "Found UTF-8 files with BOM:";
echo ${FILES};
exit 1;
fi

exit 0
File renamed without changes.
Loading