mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-12-22 18:46:11 +01:00
Commit graph

12 commits

Author SHA1 Message Date
Stefan Bürk
16aee3c836
[BUGFIX] Ensure removing dangling images works with podman (#1090)
The TYPO3 core `runTests.sh` contains the `-u` option to
update the images and remove dangling images. Providing
an image name and a `--filter` option is not supported
by podmand and has not been discovered yet in the TYPO3
core implementation yet - and adopted with the recently
sync of this repository implementation to the TYPO3 one.

Both supported docker binaries `docker` and `podman`
supportes filtering images using the `reference` filter
option. Therefore, this change modifies the dangling
image remove command to use double filter options.

To verify that double filtering can be used, following
command can be executed if already some images have
been downloaded:

```shell
podman images \
	--filter "reference=ghcr.io/sbuerk/demo-core-testing-*"
	--filter "dangling=false" --format "{{.ID}}"

docker images \
        --filter "reference=ghcr.io/sbuerk/demo-core-testing-*"
        --filter "dangling=false" --format "{{.ID}}"
```

**Note:**	`dangling=false` is used here instead of
		`dangling=true` like in `runTests.sh`

Resolves: #1088
2023-12-19 10:44:53 +01:00
Stefan Bürk
7f8f379fea
[BUGFIX] Avoid unsupported option for podman (#1089)
The TYPO3 core runTests.sh has been using the
uid option for the tmpfs mount in the past
and removed it due to the fact it's not supported
by the podman container binary.

This has been missed to change along with the
introduction of the `-b` container binary option
in #1075 and therefore the podmand and docker dual
support.

For example, following

```shell
--tmpfs ${ROOT_DIR}/typo3temp/var/tests/functional-sqlite-dbs/:rw,noexec,nosuid,uid=${HOST_UID}
```

is changed to

```shell
--tmpfs ${ROOT_DIR}/typo3temp/var/tests/functional-sqlite-dbs/:rw,noexec,nosuid
```

which works for both binaries in case of tmpfs mounts.

Resolves: #1087
Resolves: #1083
Related: #1075
2023-12-19 10:37:17 +01:00
Stefan Bürk
d97d66206f
[BUGFIX] Use better supported condition checks in runTests.sh (#1086)
With 8a2e0cb the `-b` option to select the container
binary (podman or docker) has been added. During the
adoption from the TYPO3 core implementation, it has
been discoverd that the simplified checks are not
really working and changed to the better supported
version.

Sadly, it have been missed to do the at all places
correctly.

This change covers that and modifies `runTests.sh`
to use the better supported condition form for the
container binary checks introduced with 8a2e0cb.

For example, conditions like

```shell
if [ ${CONTAINER_BIN} = "" ]; then ..
```

are changed to

```shell
if [ "${CONTAINER_BIN}" == "" ]; then ..
```

Resolves: #1085
2023-12-19 10:19:07 +01:00
Stefan Bürk
f93010c332
[BUGFIX] Use extended sbuerk/demo-core-testing-* images (#1081)
The TYPO3 core testing images only adds stuffs which is
required for the core testing itself and which can be
considered as generic project and extension testing
requirement.

This extension uses advanced `find` options which are
not part of the base busybox provided tools used by
the alpine base image, for example for the `lintYaml`
command in `Build/Scripts/runTests.sh`.

The used `-regextype` option of the `find` binary does
not exists in the stripped down busybox implementation
used by the alpine base images. The `findutils` package
is required to provide the gnu `find` command supporting
this and other advanced options, which can be found as
a solution here:

https://github.com/nextcloud/docker/issues/282

Due to the fact that the additional package will not
make the way into the TYPO3 core images like other
requirements some project or extension may have, a
demonstration github repository has been created some
time ago to demonstrate automatic extended image builds
based on the core testing images. These images already
contains stuff which is required by some projects and
extensions - and the gnu `findutils` package has been
added to these images now with the feature commit

9f8b125b6a

This change switches the used php images from the
`typo3/core-testing-phpXY` images to the extended
`sbuerk/demo-core-testing-phpXY` images.

Can be tested and verified by using

```shell
./Build/Scripts/runTests.sh -s lintYaml
```

with and without this change.

Resolves: #966
2023-12-19 09:46:50 +01:00
Stefan Bürk
8a2e0cbcff
[TASK] Add -b option to select container binary (#1076)
TYPO3 core introduced the `-b` option for the
`Build/Scripts/runTests.sh` script to provide
the ability to select the container binary,
`docker` or `podman` and enforces podman for
CI (GitLab runner) runs after switching the
Core CI infrastructure from Docker-In-Docker
to Podman-In-Podman.

The `ext:tea` adoption of the `runTests.sh`
has been already adopted on a intermediate
version and dropped the `docker-compose`
based container definitions. Along with
other minor prepration patches this allows
now to add the container binary selection
also.

This change modifies `runTests.sh` to

* add the `-b` option with a corresponding
  helptext addition and allows `podman` or
  `docker` - whereas the latter is the default.

* integrates the determined and fixed issues
  with tty in CI environments by setting some
  paramater for the commands based on the CI
  detection (GitHub Action or GitLab Runner).

Note:	The implemention for `ext:tea` does not
        enforce hardcoed the `podman` binary for
        CI environments. If no user selection is
        provided, it fallbacks to `docker` for
        all environments.

It's worth to mention that the implementation to
deal properly with user namespacing and permission
handling on mountend volumns it's required to have
at least `podman 4.x` installed. Earlier versions
does not support the required handlinging and options.

Minor moving of variable declaration are done as a
drive-by change.

The `docsGenerate` suite has been guard and display
a concrete message when executed using the `podman`
binary.

Resolves: #1075
Related: #969
2023-12-18 23:41:14 +01:00
Łukasz Uznański
5f51604f14
[TASK] Add xliff linting locally (#1071)
Resolves: #346
2023-12-15 16:17:39 +01:00
Stefan Bürk
95c2801755
[TASK] Remove acceptance test traces from runTests.sh (#1069)
The adopted `Build/Scripts/runTests.sh` contains traces
of acceptance and acceptanceInstall, mainly in the help
text.

The occurances are left-overs from the adoption phase
and are now removed due to the fact they are currently
not available at all.

Resolves: #1068
Related: #969
2023-12-15 14:20:34 +01:00
Stefan Bürk
ec56abf6aa
[TASK] Use only ghcr.io for core-testing images (#1070)
TYPO3 provides core testing docker images which
the core itself uses for the Core testing. Core
stopped publishing new image builds to the docker
hub already and only publish to the GitHub container
registry in the future.

Therefore, the image prefix switch between CI and
local does not make sense anymore.

This change removes the image prefix variables and
use public images directly from docker hub and the
core testing images from the TYPO3 `ghcr.io` repo.

Resolves: #1066
Related: #969
2023-12-15 14:13:46 +01:00
Stefan Bürk
2619a344a8
[TASK] Merge dbms version flags into -i (#1065)
Until now three different dbmns version options
has been used like the TYPO3 core in older days.

This change aligns with the TYPO3 core and merge
these options together into one flag, keeping
`-i` for all dbms vendors now and dropping `-k`
for postgres and `-j` for mysql specific versions.

The help text is modified to align with the changed
options.

Resolves: #1062
Related: #969
2023-12-15 13:33:22 +01:00
Stefan Bürk
ba486fcee3
[BUGFIX] Remove invalid argment quuoting in runTests.sh (#1029)
`Build/Scripts/runTests.sh` provides a test-suite `composer`
and allows passing additional command and options directly
down to the composer command.

Due to an invalid quoting the passed options were broking
and not regonized by the `composer` binary.

This change removes the superflous argument passing
and therefore allows passing additional options to the
`composer` command.

Resolves: #967
2023-11-27 15:35:33 +00:00
Oliver Klee
723c5da950
[FEATURE] Add support for PHP 8.3 (#965) 2023-11-01 20:20:27 +00:00
Stefan Bürk
00ba733b0e
[FEATURE] Integrate runTests.sh execution wrapper - round one (#900)
TYPO3 Core and related repositories like the `typo3/testing-framework`
or `typo3/styleguide` uses a bash script arround docker to execute all
scripts over different operating systems in a controlled and ensured
manner. This helps to reproduce locally failing jobs from a CI like
GitHub actions or GitLab.

TYPO3 core dropped recently the requirement for `docker-compose`,
reducing it to `docker` and preparing for dual usage with docker
and podman in the future.

This change integrates the current state as extension wrapper,
aligning contained suits with existing tools. Additionally, a
TYPO3 core version switch is integrated.

The added script is excluded from git archive building and
during releasing.

A list of possible options can be display with:

```shell
Build/Scripts/runTests.sh -h
```

Overview of integrated features:

* `-p` to select the PHP version (7.4 - 8.3)
* `-s` to select the suite to execute
* `-t` to select the TYPO3 core version, mainly
  needed for the `composer` suits executions
* `-e` to provide additionally flags for phpunit
  executions, e.g. for unit and functional tests
* `-x` to enable xdebug trigger - this helps with
  debugging during unit or functional test
* `-d` to select the database backend to use, needed
  for functional test execution to start the correct
  database
* `-a` to select the used php driver for the `-d`
  database backend, if multiple options are possible
* `-i` to specify the mariadb version
* `-j` to specify the mysql version
* `-k` to specify the postgres version

Available suits (`-s`):

- cgl: Checks the code style with the PHP Coding Standards Fixer
  (PHP-CS-Fixer).
- cglFix: Fixes the code style with PHP-CS-Fixer."
- clean: clean up build, cache and testing related files and
  folders
- cleanBuild: clean up build related files and folders
- cleanCache: clean up cache related files and folders
- cleanRenderedDocumentation: clean up rendered documentation
  files and folders (Documentation-GENERATED-temp)
- cleanTests: clean up test related files and folders
- composer: "composer" with all remaining arguments dispatched.
- composerInstallMax: "composer update", with no platform.php config.
- composerInstallMin: "composer update --prefer-lowest", with
  platform.php set to PHP version x.x.0.
- docsGenerate: Renders the extension ReST documentation.
- functional: PHP functional tests
- lintTypoScript: TypoScript linting
- lintPhp: PHP linting
- lintJson: JSON linting
- lintYaml: YAML linting
- phpstan: phpstan tests
- phpstanGenerateBaseline: regenerate phpstan baseline, handy after
  phpstan updates
- unit (default): PHP unit tests
- unitRandom: PHP unit tests in random order, add -o <number> to use
  specific seed

Notes:

* Not everything is available directly for now in the `runTests.sh`
  and therefore not enabled in CI.

* Coverage related execution needs extended work and are therefore
  left out for now.

* `composer.json` protection for core version changes not included
  yet like the one or other advanced option.

* Intermediate cleanings for changing php versions and core versions
  not included yet and will follow.

* typo3/testing-framework template files **must** be copied to the
  extension or project and **must not** be used from the  vendor
  folder.

Resolves: #899
Releases: main
2023-07-31 13:38:07 +02:00