Skip to content

Commit 4cccd22

Browse files
authored
Merge pull request #8 from saccas/SAC-4031-composer-abhangige-extensions-auf-saubere-v-13-version-taggen
[TASK] SAC-4031 Integrate QA tools and CI
2 parents 3494fad + 61293eb commit 4cccd22

27 files changed

+2367
-142
lines changed

.gitattributes

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
/Build/ export-ignore
2-
/.editorconfig export-ignore
3-
/.gitattributes export-ignore
4-
/.gitignore export-ignore
1+
Tests export-ignore
2+
.github export-ignore
3+
4+
.gitattributes export-ignore
5+
.gitignore export-ignore
6+
7+
phpstan-baseline.neon export-ignore
8+
phpstan.neon export-ignore
9+
phpunit.xml.dist export-ignore
10+
.php-cs-fixer.dist.php export-ignore

.github/workflows/ci.yaml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: 'CI'
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
pull_request:
8+
9+
jobs:
10+
check-composer:
11+
runs-on: 'ubuntu-latest'
12+
steps:
13+
- uses: 'actions/checkout@v3'
14+
15+
- name: 'Install PHP'
16+
uses: 'shivammathur/setup-php@v2'
17+
with:
18+
php-version: '8.4'
19+
coverage: 'none'
20+
tools: 'composer:v2'
21+
env:
22+
COMPOSER_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
23+
24+
- name: 'Validate composer.json'
25+
run: 'composer validate'
26+
27+
php-linting:
28+
runs-on: 'ubuntu-latest'
29+
strategy:
30+
matrix:
31+
php-version:
32+
- '8.2'
33+
- '8.3'
34+
- '8.4'
35+
- '8.5'
36+
steps:
37+
- name: 'Checkout'
38+
uses: 'actions/checkout@v3'
39+
40+
- name: 'Install PHP'
41+
uses: 'shivammathur/setup-php@v2'
42+
with:
43+
php-version: '${{ matrix.php-version }}'
44+
coverage: 'none'
45+
46+
- name: 'PHP lint'
47+
run: |
48+
find *.php Classes Configuration Tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
49+
50+
coding-guideline:
51+
runs-on: 'ubuntu-latest'
52+
needs:
53+
- 'check-composer'
54+
steps:
55+
- uses: 'actions/checkout@v3'
56+
57+
- name: 'Install PHP'
58+
uses: 'shivammathur/setup-php@v2'
59+
with:
60+
php-version: '8.4'
61+
coverage: 'none'
62+
tools: 'composer:v2'
63+
env:
64+
COMPOSER_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
65+
66+
- name: 'Install dependencies'
67+
run: 'composer install --no-progress --no-interaction --optimize-autoloader'
68+
69+
- name: 'Coding Guideline'
70+
run: './vendor/bin/php-cs-fixer fix --dry-run --diff'
71+
72+
tests:
73+
runs-on: 'ubuntu-latest'
74+
needs:
75+
- 'check-composer'
76+
strategy:
77+
matrix:
78+
include:
79+
- php-version: '8.2'
80+
typo3-version: '^13.4'
81+
- php-version: '8.3'
82+
typo3-version: '^13.4'
83+
- php-version: '8.4'
84+
typo3-version: '^13.4'
85+
- php-version: '8.5'
86+
typo3-version: '^13.4'
87+
steps:
88+
- uses: 'actions/checkout@v3'
89+
90+
- name: 'Install PHP'
91+
uses: 'shivammathur/setup-php@v2'
92+
with:
93+
php-version: '${{ matrix.php-version }}'
94+
coverage: 'xdebug'
95+
tools: 'composer:v2'
96+
env:
97+
COMPOSER_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
98+
99+
- name: 'Install dependencies with expected TYPO3 version'
100+
run: 'composer require --no-progress --no-interaction --optimize-autoloader "typo3/cms-core:${{ matrix.typo3-version }}"'
101+
102+
- name: 'PHPUnit Tests'
103+
run: './vendor/bin/phpunit --testdox --display-all-issues --coverage-cobertura coverage/coverage.cobertura.xml'
104+
105+
- name: 'Code Coverage Report'
106+
uses: 'irongut/CodeCoverageSummary@v1.3.0'
107+
with:
108+
filename: 'coverage/coverage.cobertura.xml'
109+
badge: false
110+
fail_below_min: true
111+
format: 'text'
112+
hide_branch_rate: true
113+
hide_complexity: true
114+
indicators: true
115+
output: 'console'
116+
thresholds: '95 100'
117+
118+
phpstan:
119+
runs-on: 'ubuntu-latest'
120+
needs:
121+
- 'check-composer'
122+
strategy:
123+
matrix:
124+
include:
125+
- php-version: '8.2'
126+
typo3-version: '^13.4'
127+
- php-version: '8.3'
128+
typo3-version: '^13.4'
129+
- php-version: '8.4'
130+
typo3-version: '^13.4'
131+
- php-version: '8.5'
132+
typo3-version: '^13.4'
133+
steps:
134+
- uses: 'actions/checkout@v3'
135+
136+
- name: 'Install PHP'
137+
uses: 'shivammathur/setup-php@v2'
138+
with:
139+
php-version: '${{ matrix.php-version }}'
140+
coverage: 'none'
141+
tools: 'composer:v2'
142+
env:
143+
COMPOSER_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
144+
145+
- name: 'Install dependencies with expected TYPO3 version'
146+
run: 'composer require --no-progress --no-interaction --optimize-autoloader "typo3/cms-core:${{ matrix.typo3-version }}"'
147+
148+
- name: 'PHPStan'
149+
run: './vendor/bin/phpstan'

.gitignore

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
1-
# macOS
2-
.DS_Store
3-
41
# ide
5-
.project
6-
.buildpath
7-
.settings
8-
.nbproject
9-
.idea
10-
!/.idea/inspectionProfiles/Project_Default.xml
11-
12-
# php-cs-fixer
13-
.php_cs.cache
14-
.php-cs-fixer.cache
2+
/.project
3+
/.buildpath
4+
/.settings
5+
/.nbproject
6+
/.idea
157

16-
# rector
17-
/.phprector.cache
8+
# git
9+
/.auth.json
1810

19-
#
20-
/.Build
21-
/var
22-
/config
11+
web
12+
vendor
Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,15 @@
22

33
declare(strict_types=1);
44

5+
use PhpCsFixer\Finder;
56
use TYPO3\CodingStandards\CsFixerConfig;
67

7-
$finder = PhpCsFixer\Finder::create()
8-
->in([
9-
__DIR__ . '/../',
10-
])
11-
->exclude([
12-
'.Build',
13-
'var',
14-
'config',
15-
]);
16-
178
return CsFixerConfig::create()
9+
->setFinder(
10+
(new Finder())
11+
->ignoreVCSIgnored(true)
12+
->in(realpath(__DIR__))
13+
)
1814
->addRules([
1915
'fully_qualified_strict_types' => [
2016
'import_symbols' => true,
@@ -26,5 +22,4 @@
2622
'single_line_empty_body' => false,
2723
'no_trailing_comma_in_singleline_array' => true,
2824
'php_unit_test_annotation' => ['style' => 'annotation'],
29-
])
30-
->setFinder($finder);
25+
]);

Build/rector.php

Lines changed: 0 additions & 37 deletions
This file was deleted.

Classes/Resource/OnlineMedia/Helpers/AbstractSrgssrHelper.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ public function getPreviewImage(File $file): string
3131

3232
if (!file_exists($temporaryFileName)) {
3333
$mediaData = $this->getMediaMetadata($videoId);
34-
$previewImage = GeneralUtility::getUrl($mediaData['chapterList'][0]['imageUrl'] . '/scale/width/1024');
3534

36-
if ($previewImage === false) {
35+
$previewImage = false;
36+
if (isset($mediaData['chapterList'][0]['imageUrl'])) {
37+
$previewImage = GeneralUtility::getUrl($mediaData['chapterList'][0]['imageUrl'] . '/scale/width/1024');
38+
}
39+
40+
if ($previewImage === false && isset($mediaData['episode']['imageUrl'])) {
3741
$previewImage = GeneralUtility::getUrl($mediaData['episode']['imageUrl'] . '/scale/width/1024');
3842
}
3943

@@ -57,8 +61,11 @@ public function transformUrlToFile($url, Folder $targetFolder): ?File
5761
}
5862

5963
$urlQueryParams = parse_url($url, PHP_URL_QUERY);
60-
parse_str($urlQueryParams, $params);
64+
if ($urlQueryParams === null) {
65+
return null;
66+
}
6167

68+
parse_str($urlQueryParams, $params);
6269
if (!empty($params['urn'])) {
6370
$mediaId = substr($params['urn'], strrpos($params['urn'], ':') + 1);
6471
return $this->transformMediaIdToFile($mediaId, $targetFolder, $this->extension);

Configuration/Services.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
services:
2+
_defaults:
3+
autowire: true
4+
autoconfigure: true
5+
public: false
6+
7+
Saccas\Srgssr\:
8+
resource: '../Classes/*'

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55
This extension enables editors to attach srf.ch videos in content elements or any other records using media files.
66
Just add a video url with the "Add media by URL" button. No setup aside from the initial installation is required.
77

8-
## Which version for which TYPO3 and PHP?
9-
10-
| Srgssr | TYPO3 | PHP | Support / Development |
11-
|--------|-----------|-----------|--------------------------------------|
12-
| 3.x | 13 LTS | 8.3 | features, bugfixes, security updates |
13-
| 2.x | 11 LTS | 8.1 | none |
14-
| 1.x | 9, 10 LTS | 7.2 - 7.4 | none |
15-
168
## Installation
179

1810
### Installation with composer
@@ -22,3 +14,14 @@ Just add a video url with the "Add media by URL" button. No setup aside from the
2214
## Thanks
2315

2416
Thanks to https://github.com/IndyIndyIndy for the youku example extension.
17+
18+
## Changelog
19+
20+
### v3.0.0
21+
22+
* Support TYPO3 v13.
23+
* Add basic CI with QA tooling.
24+
25+
### v2.0.0
26+
27+
Support TYPO3 v11.

0 commit comments

Comments
 (0)