Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 132 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,151 @@
name: tests

on:
workflow_dispatch:
push:
branches: ["**"]
pull_request:
schedule:
- cron: '27 4 * * *'

permissions:
contents: read

jobs:
testsuite:
name: all tests
name: "PHP: ${{ matrix.php }} DB: ${{ matrix.db }}"

runs-on: ubuntu-24.04

env:
RUNNER_TOOL_CACHE: ${{ github.workspace }}/.toolcache
RUNNER_TEMP: ${{ github.workspace }}/.tmp
typo3DatabaseDriver: pdo_sqlite
typo3DatabaseName: ':memory:'
TYPO3_CONTEXT: Testing

strategy:
fail-fast: true
matrix:
php: ['8.1', '8.2']
include:
# TYPO3 11
- php: 'ghcr.io/typo3/core-testing-php82:latest'
typo3: '11'
db: 'sqlite'
artifact_id: 'typo3v11-php82'
- php: 'ghcr.io/typo3/core-testing-php83:latest'
typo3: '11'
db: 'sqlite'
artifact_id: 'typo3v11-php83'
# TYPO3 12
- php: 'ghcr.io/typo3/core-testing-php83:latest'
typo3: '12'
db: 'sqlite'
artifact_id: 'typo3v12-php83'
- php: 'ghcr.io/typo3/core-testing-php84:latest'
typo3: '12'
db: 'sqlite'
artifact_id: 'typo3v12-php84'

services:
minio:
image: bitnami/minio:2025.7.23
env:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
options: >-
--health-cmd="curl -fsS http://localhost:9000/minio/health/live || exit 1"
--health-interval=5s
--health-timeout=5s
--health-retries=60
--health-start-period=20s

container: ${{ matrix.php }}

steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Composer
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s composerInstall
- name: Install Node (Alpine)
run: |
set -eux
apk add --no-cache nodejs npm git file
node -v
npm -v

- name: Composer validate
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s composerValidate
# Configure caching
- name: Cache deps (vendor + composer cache)
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.Build/composer-cache
${{ github.workspace }}/usr/local/bin/mc
${{ github.workspace }}/usr/local/bin/composer
key: artifact_id-{{ matrix.artifact_id }}

- name: GrumPHP
run: .Build/vendor/phpro/grumphp/bin/grumphp run
- run: echo "COMPOSER_CACHE_DIR=${{ github.workspace }}/.Build/composer-cache" >> "$GITHUB_ENV"

- name: Composer
run: |
/usr/local/bin/composer update --with typo3/minimal:^${{ matrix.typo3 }} --prefer-dist

- name: Lint PHP
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s lint
- name: GrumPHP
run: .Build/vendor/phpro/grumphp/bin/grumphp run --ansi --no-interaction

- name: Unit tests
run: mkdir -p .Build/Web/typo3conf/ && rm -rf .Build/Web/typo3conf/ext && ln -sfn ../../../../ .Build/Web/typo3conf/ext && Build/Scripts/runTests.sh -p ${{ matrix.php }} -s unit
env:
XDEBUG_MODE: off
run: |
.Build/bin/phpunit -c Build/UnitTests.xml

- name: Functional tests
run: mkdir -p .Build/Web/typo3conf/ && rm -rf .Build/Web/typo3conf/ext && ln -sfn ../../../../ .Build/Web/typo3conf/ext && Build/Scripts/runTests.sh -p ${{ matrix.php }} -d sqlite -s functional
- name: Install MinIO client (mc)
run: |
test -x /usr/local/bin/mc || curl -fsSL https://dl.min.io/client/mc/release/linux-amd64/mc -o /usr/local/bin/mc
chmod +x /usr/local/bin/mc
mc --version

- name: Seed MinIO
env:
MINIO_HOST: http://minio:9000
MINIO_ACCESS_KEY: minioadmin
MINIO_SECRET_KEY: minioadmin
run: |
set -e
mc alias set typo3s3test "$MINIO_HOST" "$MINIO_ACCESS_KEY" "$MINIO_SECRET_KEY"
# create bucket and allow anyonmous download
mc mb --ignore-existing typo3s3test/test-bucket/
mc anonymous set download typo3s3test/test-bucket/
# Test-User + Policy
mc admin user add typo3s3test test-key test-secretkey || true
mc admin policy attach typo3s3test readwrite --user test-key
# Upload test data
mc cp --recursive Tests/Functional/Bucketfiles/ typo3s3test/test-bucket/

- name: Functional tests (sqlite)
env:
XDEBUG_MODE: off
run: |
mkdir -p .Build/Web/typo3temp/var/tests/functional-sqlite-dbs/
.Build/bin/phpunit \
-c Build/FunctionalTests.xml

- name: Save result
if: always()
run: |
mkdir -p summary
echo "PHP=${{ matrix.php }} TYPO3=${{ matrix.typo3 }} RESULT=${{ job.status }}" \
>> summary/results.txt
- uses: actions/upload-artifact@v4
if: always()
with:
name: results-${{ matrix.artifact_id }}
path: summary/results.txt
summary:
runs-on: ubuntu-latest
needs: testsuite
if: always()
steps:
- uses: actions/download-artifact@v4
with:
path: summary
- name: Show results
run: |
echo "### Matrix results"
cat summary/**/results.txt
21 changes: 20 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
.PHONY: functional-tests tests unit-tests
PLATFORM ?= \
-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-24.04 \
-P ubuntu-24.04=ghcr.io/catthehacker/ubuntu:act-24.04
ROOT_DIR := $(shell pwd)
ACT_ARGS ?= --artifact-server-path $(ROOT_DIR)/.Build/.cache/artifacts \
--cache-server-path $(ROOT_DIR)/.Build/.cache/caches \
--container-options " --add-host minio:host-gateway \
-e ROOT_DIR=$(ROOT_DIR)"
ACT_BIN := .Build/bin/act

.PHONY: functional-tests tests unit-tests matrix

tests: unit-tests functional-tests

Expand All @@ -16,3 +26,12 @@ unit-tests: .Build/bin/phpunit .Build/Web/typo3conf/ext/aus_driver_amazon_s3
.Build/Web/typo3conf/ext/aus_driver_amazon_s3:
mkdir -p .Build/Web/typo3conf/ext/
ln -sfn ../../../../ .Build/Web/typo3conf/ext/aus_driver_amazon_s3

$(ACT_BIN):
mkdir -p .Build/bin
curl -sL https://github.com/nektos/act/releases/download/v0.2.81/act_Linux_x86_64.tar.gz \
| tar -xz -C .Build/bin act
chmod +x $@

run: $(ACT_BIN)
$(ACT_BIN) workflow_dispatch $(PLATFORM) $(ACT_ARGS)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ If you wish other hooks - don’t be shy: [GitHub issue tracking: Amazon S3 FAL

Run `make tests` to run both unit and functional tests.

Run `make run` to run multiple php versions with different TYPO3 versions tests.

To switch TYPO3 test version to 11:
```bash
composer update --with typo3/cms-core:^11.5.6
Expand Down