Skip to content

Commit 2e55ab8

Browse files
committed
Switch to Github workflows
1 parent b78bccb commit 2e55ab8

13 files changed

Lines changed: 249 additions & 193 deletions

File tree

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
custom: ["https://www.paypal.me/helhum/19.99"]
2+
github: helhum

.github/workflows/Deploy.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
tags:
6+
- "v?[0-9]+.[0-9]+.[0-9]+"
7+
8+
jobs:
9+
Ship-to-TER:
10+
name: 'Ship to TER'
11+
if: github.repository == 'helhum/typoscript_rendering'
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
17+
- name: Composer Cache Vars
18+
id: composer-cache-vars
19+
run: |
20+
echo "::set-output name=dir::$(composer config cache-files-dir)"
21+
echo "::set-output name=timestamp::$(date +"%s")"
22+
23+
- name: Cache Composer dependencies
24+
uses: actions/cache@v2
25+
with:
26+
path: ${{ steps.composer-cache-vars.outputs.dir }}
27+
key: ${{ runner.os }}-composer-^11.5.5-stable-7.4-${{ steps.composer-cache-vars.outputs.timestamp }}
28+
restore-keys: |
29+
${{ runner.os }}-composer-^11.5.5-stable-7.4-
30+
${{ runner.os }}-composer-^11.5.5-stable-
31+
${{ runner.os }}-composer-^11.5.5-
32+
${{ runner.os }}-composer-
33+
34+
- name: Set up PHP
35+
uses: shivammathur/setup-php@v2
36+
with:
37+
php-version: 7.4
38+
coverage: none
39+
40+
- name: "Extract tag, branch, version from GITHUB_REF"
41+
id: "github-ref"
42+
run: |
43+
echo "::set-output name=tag::$(echo $GITHUB_REF | sed -E -n 's#^refs/tags/(.*)$#\1#p')"
44+
echo "::set-output name=branch::$(echo $GITHUB_REF | sed -E -n 's#^refs/heads/(.*)$#\1#p')"
45+
echo "::set-output name=version::$(echo $GITHUB_REF | sed -E -n 's#^refs/tags/v?([0-9]+\.)([0-9]+\.)([0-9]+)#\1\2\3#p')"
46+
47+
- name: Deploy to TER
48+
run: |
49+
if [ -n "${{ secrets.TYPO3_ORG_USERNAME }}" ] && [ -n "${{ secrets.TYPO3_ORG_PASSWORD }}" ]; then
50+
echo -e "Preparing upload of release ${{ steps.github-ref.outputs.version }} to TER\n";
51+
# Install ter client
52+
composer global require helhum/ter-client
53+
PATH=$PATH:$(composer global config bin-dir --absolute --quiet);
54+
55+
# Upload
56+
TAG_MESSAGE=$(git tag -n10 -l ${{ steps.github-ref.outputs.tag }} | sed 's/^[v]*[0-9.]*[ ]*//g')
57+
echo "Uploading release ${{ steps.github-ref.outputs.version }} to TER"
58+
ter-client upload typoscript_rendering . -u "${{ secrets.TYPO3_ORG_USERNAME }}" -p "${{ secrets.TYPO3_ORG_PASSWORD }}" -m "$TAG_MESSAGE"
59+
fi;

.github/workflows/Test.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
11+
Tests:
12+
name: 'T3 ${{ matrix.typo3 }} - PHP ${{ matrix.php }} - ${{ matrix.dependency-version }}'
13+
runs-on: ubuntu-18.04
14+
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
typo3: [ '^9.5.0', '^10.4.0', '^11.5.0' ]
19+
php: [ '7.4' ]
20+
dependency-version: [ lowest, stable ]
21+
experimental: [ false ]
22+
include:
23+
- php: 7.2
24+
typo3: '^9.5.0'
25+
dependency-version: stable
26+
experimental: false
27+
- php: 7.3
28+
typo3: '^9.5.0'
29+
dependency-version: stable
30+
experimental: false
31+
- php: 7.2
32+
typo3: '^10.4.0'
33+
dependency-version: stable
34+
experimental: false
35+
- php: 7.3
36+
typo3: '^10.4.0'
37+
dependency-version: stable
38+
experimental: false
39+
- php: 8.0
40+
typo3: '^11.5.0'
41+
dependency-version: stable
42+
experimental: true
43+
44+
continue-on-error: ${{ matrix.experimental }}
45+
46+
steps:
47+
- name: Start database server
48+
run: sudo /etc/init.d/mysql start
49+
50+
- name: Checkout
51+
uses: actions/checkout@v2
52+
53+
- name: Composer Cache Vars
54+
id: composer-cache-vars
55+
run: |
56+
echo "::set-output name=dir::$(composer config cache-files-dir)"
57+
echo "::set-output name=timestamp::$(date +"%s")"
58+
59+
- name: Cache Composer dependencies
60+
uses: actions/cache@v2
61+
with:
62+
path: ${{ steps.composer-cache-vars.outputs.dir }}
63+
key: ${{ runner.os }}-composer-${{ matrix.typo3 }}-${{ matrix.dependency-version }}-${{ matrix.php }}-${{ steps.composer-cache-vars.outputs.timestamp }}
64+
restore-keys: |
65+
${{ runner.os }}-composer-${{ matrix.typo3 }}-${{ matrix.dependency-version }}-${{ matrix.php }}-
66+
${{ runner.os }}-composer-${{ matrix.typo3 }}-${{ matrix.dependency-version }}-
67+
${{ runner.os }}-composer-${{ matrix.typo3 }}-
68+
${{ runner.os }}-composer-
69+
70+
- name: Set up PHP Version ${{ matrix.php }}
71+
uses: shivammathur/setup-php@v2
72+
with:
73+
php-version: ${{ matrix.php }}
74+
tools: composer:v2
75+
coverage: none
76+
77+
- name: Environment Check
78+
run: |
79+
php --version
80+
composer --version
81+
82+
- name: Validate composer.json and composer.lock
83+
run: composer validate
84+
85+
- name: Install
86+
run: |
87+
composer update --with typo3/cms-core="${{ matrix.typo3 }}" --prefer-${{ matrix.dependency-version }} --prefer-dist --no-interaction
88+
89+
- name: Lint
90+
run: .Build/bin/parallel-lint --exclude vendor --exclude .Build .
91+
92+
- name: Unit Tests
93+
run: .Build/bin/phpunit -c .Build/vendor/nimut/testing-framework/res/Configuration/UnitTests.xml Tests/Unit/
94+
95+
- name: Functional Tests
96+
env:
97+
typo3DatabaseName: typo3
98+
typo3DatabaseHost: '127.0.0.1'
99+
typo3DatabaseUsername: root
100+
typo3DatabasePassword: root
101+
run: .Build/bin/phpunit -c .Build/vendor/nimut/testing-framework/res/Configuration/FunctionalTests.xml Tests/Functional/

.travis.yml

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

Classes/Uri/TyposcriptRenderingUri.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@ private function parseViewHelperContext(ViewHelperContext $viewHelperContext): v
8282
$additionalParams['tx_typoscriptrendering']['context'] = json_encode($renderingConfiguration);
8383

8484
$uriBuilder = $controllerContext->getUriBuilder();
85-
$uriBuilder->reset()
86-
->setUseCacheHash(true)
85+
$uriBuilder->reset();
86+
if (is_callable([$uriBuilder, 'setUseCacheHash'])) {
87+
$uriBuilder->setUseCacheHash(true);
88+
}
89+
$uriBuilder
8790
->setSection($arguments['section'] ?? '')
8891
->setFormat($arguments['format'] ?? 'html')
8992
->setLinkAccessRestrictedPages($arguments['linkAccessRestrictedPages'] ?? false)
@@ -101,8 +104,8 @@ private function parseViewHelperContext(ViewHelperContext $viewHelperContext): v
101104
$arguments['action'] ?? null,
102105
$arguments['arguments'] ?? null,
103106
$arguments['controller'] ?? null,
104-
$extensionName,
105-
$pluginName
107+
$extensionName ?? '',
108+
$pluginName ?? ''
106109
),
107110
$renderingPath !== null
108111
);

Tests/Functional/AbstractRenderingTestCase.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Nimut\TestingFramework\Http\Response;
1818
use Nimut\TestingFramework\TestCase\FunctionalTestCase;
1919
use PHPUnit\Util\PHP\DefaultPhpProcess;
20+
use SebastianBergmann\Template\Template;
2021
use TYPO3\CMS\Core\Utility\GeneralUtility;
2122

2223
/**
@@ -29,16 +30,17 @@ abstract class AbstractRenderingTestCase extends FunctionalTestCase
2930
*/
3031
protected $testExtensionsToLoad = ['typo3conf/ext/typoscript_rendering'];
3132

32-
/**
33-
* @var string[]
34-
*/
35-
protected $coreExtensionsToLoad = ['fluid'];
33+
protected $configurationToUseInTestInstance = [
34+
'SYS' => [
35+
'encryptionKey' => '42',
36+
],
37+
];
3638

37-
public function setUp()
39+
public function setUp(): void
3840
{
3941
parent::setUp();
4042
$this->importDataSet(__DIR__ . '/Fixtures/Database/pages.xml');
41-
$this->setUpFrontendRootPage(1, ['EXT:typoscript_rendering/Tests/Functional/Fixtures/Frontend/Basic.ts']);
43+
$this->setUpFrontendRootPage(1, ['EXT:typoscript_rendering/Tests/Functional/Fixtures/Frontend/Basic.typoscript']);
4244
}
4345

4446
/* ***********************************************
@@ -55,6 +57,7 @@ public function setUp()
5557
protected function getRenderUrl($pageId, $languageId, $path)
5658
{
5759
$requestArguments = ['id' => $pageId, 'L' => $languageId, 'path' => $path];
60+
5861
return $this->fetchFrontendResponse($requestArguments)->getContent();
5962
}
6063

@@ -77,7 +80,8 @@ protected function fetchFrontendResponse(array $requestArguments, $failOnFailure
7780
'requestUrl' => 'http://localhost' . $requestUrl,
7881
];
7982

80-
$template = new \Text_Template('ntf://Frontend/Request.tpl');
83+
$textTemplateClass = class_exists(Template::class) ? Template::class : \Text_Template::class;
84+
$template = new $textTemplateClass('ntf://Frontend/Request.tpl');
8185
$template->setVar(
8286
[
8387
'arguments' => var_export($arguments, true),
@@ -86,11 +90,7 @@ protected function fetchFrontendResponse(array $requestArguments, $failOnFailure
8690
]
8791
);
8892

89-
if (class_exists('PHPUnit_Util_PHP')) {
90-
$php = \PHPUnit_Util_PHP::factory();
91-
} else {
92-
$php = DefaultPhpProcess::factory();
93-
}
93+
$php = DefaultPhpProcess::factory();
9494
$response = $php->runJob($template->render());
9595
$result = json_decode($response['stdout'], true);
9696

Tests/Functional/FeNoPhpScriptIncludeRenderingTest.php

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

0 commit comments

Comments
 (0)