Skip to content
Snippets Groups Projects
Commit 929ea0a6 authored by Norman Steger's avatar Norman Steger
Browse files

remove gitlab ci

parent 22d61ec4
No related branches found
No related tags found
No related merge requests found
Require all denied
# use as git subtree (preferred)
## add gitlab-ci to your extension
```
git subtree add --prefix .Build/gitlab-ci https://git.slub-dresden.de/typo3/gitlab-ci.git main --squash
```
## add a .gitlab-ci.yml to your extension root, with this content
```
include:
- local: '.Build/gitlab-ci/extension-gitlab-ci.yml'
```
## pull from remote
```
git subtree pull --prefix .Build/gitlab-ci https://git.slub-dresden.de/typo3/gitlab-ci.git main --squash
```
## push from remote
```
git subtree push --prefix .Build/gitlab-ci https://git.slub-dresden.de/typo3/gitlab-ci.git main
```
# use from remote repository
## add a .gitlab-ci.yml to your extension root, with this content
```
include:
- remote: 'https://git.slub-dresden.de/typo3/gitlab-ci/-/raw/main/extension-gitlab-ci.yml'
```
## create a .gitignore in your extension root, with this content
```
composer.lock
/vendor
/public
.php_cs.cache
```
# use rector local
```
composer require --dev ssch/typo3-rector
```
## run rector
```
./vendor/bin/rector process . --config .Build/gitlab-ci/typo3-rector/Extension.php
```
# use php-cs-fixer local
```
composer require --dev friendsofphp/php-cs-fixer
```
## run php-cs-fixer
```
./vendor/bin/php-cs-fixer fix --config .Build/gitlab-ci/php-cs-fixer/Extension.php
```
# use typo3-typoscript-lint local
```
composer require --dev helmich/typo3-typoscript-lint
```
## run php-cs-fixer
```
vendor/bin/typoscript-lint -c .Build/gitlab-ci/typoscript-lint/Extension.yml --fail-on-warnings
```
stages:
- test
"PHP CS Fixer":
stage: test
image: ekreative/php-cs-fixer:3
script:
- php-cs-fixer fix --dry-run --config=.php-cs-fixer/Extension.php --diff --format=junit > php-report.xml
tags:
- docker
artifacts:
expire_in: 2 hours
reports:
junit:
- php-report.xml
"PHP Rector":
stage: test
image: composer:2
tags:
- docker
before_script:
- composer global req ssch/typo3-rector
script:
- /tmp/vendor/bin/rector process . --config .typo3-rector/Extension.php --dry-run
"TypoScript Linter":
stage: test
image: composer:2
tags:
- docker
before_script:
- composer global req helmich/typo3-typoscript-lint
script:
- /tmp/vendor/bin/typoscript-lint -c .typoscript-lint/Extension.yml --fail-on-warnings
\ No newline at end of file
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* This file represents the configuration for Code Sniffing PSR-2-related
* automatic checks of coding guidelines
* Install @fabpot's great php-cs-fixer tool via
*
* $ composer global require friendsofphp/php-cs-fixer
*
* And then simply run
*
* $ ./bin/php-cs-fixer fix --config ./Build/gitlab-ci/php-cs-fixer/Extension.php
*
* inside the TYPO3 directory. Warning: This may take up to 10 minutes.
*
* For more information read:
* https://www.php-fig.org/psr/psr-2/
* https://cs.sensiolabs.org
*/
if (PHP_SAPI !== 'cli') {
die('This script supports command line usage only. Please check your command.');
}
// Define in which folders to search and which folders to exclude
// Exclude all files and directories from .gitignore
$finder = (new PhpCsFixer\Finder())
->ignoreVCSIgnored(true)
->in(realpath(__DIR__ . '/../../../'));
// Return a Code Sniffing configuration using
// all sniffers needed for PSR-2
// and additionally:
// - Remove leading slashes in use clauses.
// - PHP single-line arrays should not have trailing comma.
// - Single-line whitespace before closing semicolon are prohibited.
// - Remove unused use statements in the PHP source code
// - Ensure Concatenation to have at least one whitespace around
// - Remove trailing whitespace at the end of blank lines.
return (new \PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@DoctrineAnnotation' => true,
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'blank_line_after_opening_tag' => false,
'braces' => ['allow_single_line_closure' => true],
'cast_spaces' => ['space' => 'none'],
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'],
'dir_constant' => true,
'function_typehint_space' => true,
'lowercase_cast' => true,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'modernize_types_casting' => true,
'native_function_casing' => true,
'new_with_braces' => true,
'no_alias_functions' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_null_property_initialization' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_control_parentheses' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_whitespace_in_blank_line' => true,
'ordered_imports' => true,
'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']],
'php_unit_mock_short_will_return' => true,
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'phpdoc_no_access' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_no_package' => true,
'phpdoc_scalar' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'return_type_declaration' => ['space_before' => 'none'],
'single_quote' => true,
'single_line_comment_style' => ['comment_types' => ['hash']],
'single_trait_insert_per_statement' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'whitespace_after_comma_in_array' => true,
])
->setFinder($finder);
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Core\Configuration\Option;
use Rector\Core\ValueObject\PhpVersion;
use Rector\PostRector\Rector\NameImportingPostRector;
use Ssch\TYPO3Rector\Configuration\Typo3Option;
use Ssch\TYPO3Rector\Rector\General\ConvertImplicitVariablesToExplicitGlobalsRector;
use Ssch\TYPO3Rector\Rector\General\ExtEmConfRector;
use Ssch\TYPO3Rector\Set\Typo3LevelSetList;
return static function (RectorConfig $rectorConfig): void {
// If you want to override the number of spaces for your typoscript files you can define it here, the default value is 4
// $parameters = $rectorConfig->parameters();
// $parameters->set(Typo3Option::TYPOSCRIPT_INDENT_SIZE, 2);
$rectorConfig->sets([
Typo3LevelSetList::UP_TO_TYPO3_9,
Typo3LevelSetList::UP_TO_TYPO3_10,
Typo3LevelSetList::UP_TO_TYPO3_11,
]);
// Define your target version which you want to support
$rectorConfig->phpVersion(PhpVersion::PHP_74);
// If you only want to process one/some TYPO3 extension(s), you can specify its path(s) here.
// If you use the option --config change __DIR__ to getcwd()
// $rectorConfig->paths([
// __DIR__ . '/packages/acme_demo/',
// ]);
// When you use rector there are rules that require some more actions like creating UpgradeWizards for outdated TCA types.
// To fully support you we added some warnings. So watch out for them.
// If you use importNames(), you should consider excluding some TYPO3 files.
$rectorConfig->skip([
// @see https://github.com/sabbelasichon/typo3-rector/issues/2536
getcwd() . '/**/Configuration/ExtensionBuilder/*',
// We skip those directories on purpose as there might be node_modules or similar
// that include typescript which would result in false positive processing
getcwd() . '/**/Resources/**/node_modules/*',
getcwd() . '/**/Resources/**/NodeModules/*',
getcwd() . '/**/Resources/**/BowerComponents/*',
getcwd() . '/**/Resources/**/bower_components/*',
getcwd() . '/**/Resources/**/build/*',
getcwd() . '/vendor/*',
getcwd() . '/Build/*',
getcwd() . '/public/*',
getcwd() . '/.github/*',
getcwd() . '/.Build/*',
NameImportingPostRector::class => [
'ext_localconf.php',
'ext_tables.php',
'ClassAliasMap.php',
getcwd() . '/**/Configuration/*.php',
getcwd() . '/**/Configuration/**/*.php',
]
]);
// If you have trouble that rector cannot run because some TYPO3 constants are not defined add an additional constants file
// @see https://github.com/sabbelasichon/typo3-rector/blob/master/typo3.constants.php
// @see https://github.com/rectorphp/rector/blob/main/docs/static_reflection_and_autoload.md#include-files
// $parameters->set(Option::BOOTSTRAP_FILES, [
// __DIR__ . '/typo3.constants.php'
// ]);
// register a single rule
// $rectorConfig->rule(\Ssch\TYPO3Rector\Rector\v9\v0\InjectAnnotationRector::class);
/**
* Useful rule from RectorPHP itself to transform i.e. GeneralUtility::makeInstance('TYPO3\CMS\Core\Log\LogManager')
* to GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class) calls.
* But be warned, sometimes it produces false positives (edge cases), so watch out
*/
// $rectorConfig->rule(\Rector\Php55\Rector\String_\StringClassNameToClassConstantRector::class);
// Optional non-php file functionalities:
// @see https://github.com/sabbelasichon/typo3-rector/blob/main/docs/beyond_php_file_processors.md
// Rewrite your extbase persistence class mapping from typoscript into php according to official docs.
// This processor will create a summarized file with all the typoscript rewrites combined into a single file.
/* $rectorConfig->ruleWithConfiguration(\Ssch\TYPO3Rector\FileProcessor\TypoScript\Rector\v10\v0\ExtbasePersistenceTypoScriptRector::class, [
\Ssch\TYPO3Rector\FileProcessor\TypoScript\Rector\v10\v0\ExtbasePersistenceTypoScriptRector::FILENAME => __DIR__ . '/packages/acme_demo/Configuration/Extbase/Persistence/Classes.php',
]); */
// Add some general TYPO3 rules
$rectorConfig->rule(ConvertImplicitVariablesToExplicitGlobalsRector::class);
$rectorConfig->ruleWithConfiguration(ExtEmConfRector::class, [
ExtEmConfRector::ADDITIONAL_VALUES_TO_BE_REMOVED => []
]);
// Modernize your TypoScript include statements for files and move from <INCLUDE /> to @import use the FileIncludeToImportStatementVisitor (introduced with TYPO3 9.0)
// $rectorConfig->rule(\Ssch\TYPO3Rector\FileProcessor\TypoScript\Rector\v9\v0\FileIncludeToImportStatementTypoScriptRector::class);
};
paths:
- Configuration/
filePatterns:
- "*.tsconfig"
- "*.typoscript"
- "ext_typoscript_*.txt"
- "setup.txt"
- "constants.txt"
sniffs:
- class: Indentation
parameters:
useSpaces: true
indentPerLevel: 2
indentConditions: false
- class: DeadCode
- class: OperatorWhitespace
- class: RepeatingRValue
disabled: true
- class: EmptySection
- class: NestingConsistency
parameters:
commonPathPrefixThreshold: 1
const sass = require('node-sass');
module.exports = function(grunt) {
/**
* Project configuration.
*/
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
paths: {
root: '../../',
resources: '<%= paths.root %>Resources/',
sass: '<%= paths.resources %>Public/Scss/',
css: '<%= paths.resources %>Public/Css/',
fonts: '<%= paths.resources %>Public/Fonts/',
img: '<%= paths.resources %>Public/Images/',
js: '<%= paths.resources %>Public/JavaScript/'
},
banner: '/*!\n' +
' * SLUB Web Bison v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
' * Copyright 2023-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
' * Licensed under the <%= pkg.license %> license\n' +
' */\n',
uglify: {
all: {
options: {
banner: '<%= banner %>',
mangle: true,
compress: true,
beautify: false
},
files: {
"<%= paths.js %>/Dist/scripts.js": [
"<%= paths.js %>Src/main.js"
]
}
}
},
sass: {
options: {
implementation: sass,
outputStyle: 'expanded',
precision: 8,
sourceMap: false
},
layout: {
files: {
'<%= paths.css %>layout.css': '<%= paths.sass %>layout.scss'
}
}
},
postcss: {
options: {
map: false,
processors: [
require('autoprefixer')({
browsers: [
'Last 2 versions',
'Firefox ESR',
'IE 9'
]
})
]
},
layout: {
src: '<%= paths.css %>layout.css'
}
},
cssmin: {
options: {
keepSpecialComments: '*',
advanced: false
},
layout: {
src: '<%= paths.css %>layout.css',
dest: '<%= paths.css %>layout.min.css'
}
},
imagemin: {
extension: {
files: [{
expand: true,
cwd: '<%= paths.resources %>',
src: [
'**/*.{png,jpg,gif}'
],
dest: '<%= paths.resources %>'
}]
}
},
watch: {
options: {
livereload: true
},
sass: {
files: '<%= paths.sass %>**/*.scss',
tasks: ['css']
},
javascript: {
files: '<%= paths.js %>Src/**/*.js',
tasks: ['js']
}
}
});
/**
* Register tasks
// */
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-postcss');
grunt.loadNpmTasks('grunt-sass');
/**
* Grunt update task
*/
grunt.registerTask('css', ['sass', 'postcss', 'cssmin']);
grunt.registerTask('js', ['uglify']);
grunt.registerTask('build', ['js', 'css', 'imagemin']);
grunt.registerTask('default', ['build']);
};
# Frontend development (based on Grunt)
This extension comes with a [Grunt](https://gruntjs.com/) setup which uses some typical [NPM packages](https://www.npmjs.com/) like jshint, uglify, less aso.
You can simply get it running by installing the local needings of NPM with
```
npm install --save-dev
```
on your command line from the source folder of this extension.
After that, just type
```
grunt
```
to start the processing which watches all the LESS and JS folders to generate new asset files on the fly if anythings changes.
## Auto-Update NPM dependencies
We recommend [setting up a post-merge hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) in your repository to auto-update NPM dependencies. Simply create the post-merge file with the following content in the `.git/hooks` directory of the repository. Make sure the file is executable.
```
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
}
check_run package.json "npm install --save-dev"
```
This hook will check for changes in the `package.json` and will run `npm install` to update the installed dependencies accordingly. Withhout this hook you have to do this manually after changes to package.json have been made to stay up-to-date.
{
"name": "slub-dresden-slub-web-bison",
"description": "TYPO3 Sitepackage for B!SON - Bibliometric and Semantic Open Access Recommender Network",
"repository": {
"type": "git",
"url": "https://git.slub-dresden.de/slub_web_bison"
},
"homepage": "https://www.slub-dresden.de",
"author": "SLUB TYPO3 Team",
"version": "1.0.0",
"license": "GPL-2.0-or-later",
"devDependencies": {
"grunt": "^1.0.4",
"grunt-contrib-cssmin": "^3.0.0",
"grunt-contrib-uglify": "^4.0.1",
"grunt-contrib-watch": "^1.1.0",
"grunt-contrib-imagemin": "^3.1.0",
"grunt-postcss": "^0.9.0",
"grunt-sass": "^3.0.2",
"autoprefixer": "^9.5.0",
"node-sass": "^4.11.0"
},
"scripts": {
"build": "./node_modules/.bin/grunt",
"css": "./node_modules/.bin/grunt css",
"watch": "./node_modules/.bin/grunt watch"
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment