Skip to content

Commit 0bc6520

Browse files
committed
[TASK] update testing setup
based on https://git.typo3.org/qa/example-extension from the best practices team
1 parent a26f27a commit 0bc6520

10 files changed

+528
-575
lines changed

.ecrc

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"NoColor": false,
77
"Exclude": [
88
".Build",
9+
".cache",
910
".git",
1011
".DS_Store",
1112
".xsd",

.github/workflows/tests.yml

+50-88
Original file line numberDiff line numberDiff line change
@@ -5,128 +5,90 @@ on: [push, pull_request]
55
jobs:
66
lint:
77
name: Source code linting
8-
runs-on: ubuntu-latest
8+
runs-on: ubuntu-24.04
9+
strategy:
10+
max-parallel: 2
11+
matrix:
12+
php-versions: ['8.2']
913
steps:
10-
-
14+
- name: "Checkout"
1115
uses: actions/checkout@v4
1216

13-
-
14-
name: Set up Docker Compose
15-
run: |
16-
docker-compose --version || {
17-
echo "Docker Compose not found, installing..."
18-
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
19-
sudo chmod +x /usr/local/bin/docker-compose
20-
docker-compose --version
21-
}
22-
23-
-
24-
name: Validate composer.json
25-
run: Build/Scripts/runTests.sh -s composerValidate
26-
27-
-
28-
name: Cache composer dependencies
17+
- name: Validate composer.json
18+
run: Build/Scripts/runTests.sh -s composer validate
19+
20+
- name: Cache dependencies installed with composer
2921
uses: actions/cache@v4
3022
with:
31-
path: ~/.composer/cache
32-
key: composer
23+
key: "php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
24+
path: .cache/composer
25+
restore-keys: "php${{ matrix.php-version }}-composer-\n"
3326

34-
-
35-
name: Install composer dependencies
36-
run: Build/Scripts/runTests.sh -s composerInstall
27+
- name: Install composer dependencies
28+
run: Build/Scripts/runTests.sh -s composer install
3729

38-
-
39-
name: PHP Linting
30+
- name: PHP Linting
4031
run: Build/Scripts/runTests.sh -s lintPhp
4132

42-
-
43-
name: Editorconfig Linting
33+
- name: Editorconfig Linting
4434
run: Build/Scripts/runTests.sh -s lintEditorconfig
4535

4636

4737
unittest:
48-
runs-on: ubuntu-latest
49-
38+
runs-on: ubuntu-24.04
5039
strategy:
5140
max-parallel: 2
5241
matrix:
53-
php-versions: ['8.3', '8.2']
54-
typo3-versions: [13, 12]
42+
php-versions: ['8.2', '8.3']
43+
typo3-versions: ['13.2', '12.4']
5544

56-
name: Unit (PHP ${{ matrix.php-versions }}, TYPO3 ${{ matrix.typo3-versions }})
45+
name: Unit Testing (PHP ${{ matrix.php-versions }}, TYPO3 ${{ matrix.typo3-versions }})
5746
steps:
58-
-
47+
- name: "Checkout"
5948
uses: actions/checkout@v4
6049

61-
-
62-
name: Set up Docker Compose
63-
run: |
64-
docker-compose --version || {
65-
echo "Docker Compose not found, installing..."
66-
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
67-
sudo chmod +x /usr/local/bin/docker-compose
68-
docker-compose --version
69-
}
70-
71-
-
72-
name: Validate composer.json
73-
run: Build/Scripts/runTests.sh -p ${{ matrix.php-versions }} -t ${{ matrix.typo3-versions }} -s composerValidate
74-
75-
-
76-
name: Cache composer dependencies
50+
- name: Validate composer.json
51+
run: Build/Scripts/runTests.sh -s composer validate
52+
53+
- name: Cache dependencies installed with composer
7754
uses: actions/cache@v4
7855
with:
79-
path: ~/.composer/cache
80-
key: php-${{ matrix.php-versions }}-typo3-${{ matrix.typo3-versions }}
56+
key: "php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
57+
path: .cache/composer
58+
restore-keys: "php${{ matrix.php-version }}-composer-\n"
8159

82-
-
83-
name: Install composer dependencies
84-
run: Build/Scripts/runTests.sh -p ${{ matrix.php-versions }} -t ${{ matrix.typo3-versions }} -s composerInstall
60+
- name: Install composer dependencies
61+
run: Build/Scripts/runTests.sh -p ${{ matrix.php-versions }} -t ${{ matrix.typo3-versions }} -s composerUpdateMin
8562

86-
-
87-
name: Automated Unit Testing
88-
run: Build/Scripts/runTests.sh -p ${{ matrix.php-versions }} -t ${{ matrix.typo3-versions }} -s unit
63+
- name: Automated Unit Testing
64+
run: Build/Scripts/runTests.sh -s unit
8965

9066

91-
functionaltest:
92-
runs-on: ubuntu-latest
93-
67+
functional:
68+
runs-on: ubuntu-24.04
9469
strategy:
9570
max-parallel: 2
9671
matrix:
97-
php-versions: ['8.3', '8.2']
98-
typo3-versions: [13, 12]
72+
php-versions: ['8.2', '8.3']
73+
typo3-versions: ['13.2', '12.4']
9974

100-
name: Functional (PHP ${{ matrix.php-versions }}, TYPO3 ${{ matrix.typo3-versions }})
75+
name: Functional Testing (PHP ${{ matrix.php-versions }}, TYPO3 ${{ matrix.typo3-versions }})
10176
steps:
102-
-
77+
- name: "Checkout"
10378
uses: actions/checkout@v4
10479

105-
-
106-
name: Set up Docker Compose
107-
run: |
108-
docker-compose --version || {
109-
echo "Docker Compose not found, installing..."
110-
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
111-
sudo chmod +x /usr/local/bin/docker-compose
112-
docker-compose --version
113-
}
114-
115-
-
116-
name: Validate composer.json
117-
run: Build/Scripts/runTests.sh -p ${{ matrix.php-versions }} -t ${{ matrix.typo3-versions }} -s composerValidate
118-
119-
-
120-
name: Cache composer dependencies
80+
- name: Validate composer.json
81+
run: Build/Scripts/runTests.sh -s composer validate
82+
83+
- name: Cache dependencies installed with composer
12184
uses: actions/cache@v4
12285
with:
123-
path: ~/.composer/cache
124-
key: php-${{ matrix.php-versions }}-typo3-${{ matrix.typo3-versions }}
86+
key: "php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
87+
path: .cache/composer
88+
restore-keys: "php${{ matrix.php-version }}-composer-\n"
12589

126-
-
127-
name: Install composer dependencies
128-
run: Build/Scripts/runTests.sh -p ${{ matrix.php-versions }} -t ${{ matrix.typo3-versions }} -s composerInstall
90+
- name: Install composer dependencies
91+
run: Build/Scripts/runTests.sh -p ${{ matrix.php-versions }} -t ${{ matrix.typo3-versions }} -s composerUpdateMin
12992

130-
-
131-
name: Automated Functional Testing
132-
run: Build/Scripts/runTests.sh -p ${{ matrix.php-versions }} -t ${{ matrix.typo3-versions }} -s functional
93+
- name: Automated Unit Testing
94+
run: Build/Scripts/runTests.sh -s functional

.gitignore

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.Build
2-
composer.lock
2+
.cache
3+
/Build/phpunit/.phpunit.cache/
34
/var
4-
/Build/Testing/.phpunit.result.cache
5-
/Build/Testing/.phpunit.cache/
6-
/Build/testing-docker/.env
5+
composer.lock

0 commit comments

Comments
 (0)