Skip to content

Commit

Permalink
Merge pull request #6 from schliesser/feature/testing-and-ci-integration
Browse files Browse the repository at this point in the history
Feature/testing and ci integration
  • Loading branch information
schliesser authored Aug 12, 2020
2 parents 1edcb73 + e71069a commit a41103e
Show file tree
Hide file tree
Showing 10 changed files with 552 additions and 24 deletions.
50 changes: 50 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# EditorConfig is awesome: http://EditorConfig.org

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.{ts,js}]
indent_style = space
indent_size = 2

# JSON-Files
[*.json]
indent_style = tab
indent_size = 4

# ReST-Files
[*.rst]
indent_style = space
indent_size = 3

# package.json
# .travis.yml
# bower.json
[{package.json,.travis.yml,bower.json,composer.json}]
indent_style = space
indent_size = 2

# TypoScript
[{*.typoscript,*.tsconfig,setup.txt,constants.txt,ext_typoscript_setup.txt,ext_typoscript_constants.txt,ext_conf_template.txt}]
indent_style = space
indent_size = 2

# XML-Files
[{*.xml,*.xlf}]
indent_style = space
indent_size = 2

# SQL-Files
[*.sql]
indent_style = tab
indent_size = 2

# ChangeLog files
[{ChangeLog,ChangeLog.txt}]
indent_style = tab
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/.Build/ export-ignore
/Tests/ export-ignore
/.gitattributes export-ignore
/.github/ export-ignore
/.gitignore export-ignore
/.gitlab-ci.yml export-ignore
/.scrutinizer export-ignore
/.styleci.yml export-ignore
/.travis.yml export-ignore
/.php_cs.dist export-ignore
53 changes: 53 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---

name: "TER deployment"

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
# The actual TER upload job
ter-release:
name: "TYPO3 TER release"

# Run only if it's a tag in general (as regex is not possible here)
if: startsWith(github.ref, 'refs/tags/')

runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [7.4]

env:
TYPO3_EXTENSION_KEY: sitecrawler
TYPO3_USER: ${{ secrets.TYPO3_USER }}
TYPO3_PASSWORD: ${{ secrets.TYPO3_PASSWORD }}

steps:
- uses: actions/checkout@v2
with:
path: ${{ env.TYPO3_EXTENSION_KEY }}

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: intl, mbstring, xml, soap, zip, curl

- name: Install TYPO3 TER client

run: composer global require namelesscoder/typo3-repository-client
"^2.0" --prefer-dist --no-progress --no-suggest

- name: Remove .git folder
run: rm -rf ./$TYPO3_EXTENSION_KEY/.git

- name: List extension folder
run: ls -liAsh ./$TYPO3_EXTENSION_KEY

- name: Upload EXT:${{ env.TYPO3_EXTENSION_KEY }}
as ${{ github.event.ref }} to TER
run: php ~/.composer/vendor/bin/upload "./$TYPO3_EXTENSION_KEY"
"$TYPO3_USER" "$TYPO3_PASSWORD"
"${{ github.event.head_commit.message }}"
99 changes: 99 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
---
name: Test

on: [push, pull_request]

jobs:
php-lint:
name: "PHP linter"
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [7.2, 7.3, 7.4]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-versions }}"
- name: "Cache composer dependencies"
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: php-${{ matrix.php-versions }}
-composer-${{ hashFiles('composer.json') }}
restore-keys: |
php-${{ matrix.php-versions }}-composer-
- name: "Install composer dependencies"
run: composer install --no-progress
- name: "Run PHP lint"
run: "composer run-script test-php-lint"
php-cs-fixer:
name: "PHP-CS-Fixer"
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [7.4]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-versions }}"
- name: "Cache composer dependencies"
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: php-${{ matrix.php-versions }}
-composer-${{ hashFiles('composer.json') }}
restore-keys: |
php-${{ matrix.php-versions }}-composer-
- name: "Install composer dependencies"
run: composer install --no-progress
- name: "Run PHP-CS-Fixer"
run: "composer run-script test-php-cs-fixer"
tests:
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
php-versions: [7.2, 7.3, 7.4]
typo3-versions:
- {typo3: 9, testing: 4}
- {typo3: 10, testing: 5}

name: "Run tests with PHP ${{ matrix.php-versions }}
using TYPO3 ${{ matrix.typo3-versions.typo3 }}
with testing framework version ${{ matrix.typo3-versions.testing }}"
steps:
- uses: actions/checkout@v2

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: xml, mbstring, curl

- name: "Cache composer dependencies"
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: php-${{ matrix.php-versions }}
-typo3-${{ matrix.typo3-versions.typo3 }}
-testing-${{ matrix.typo3-versions.testing }}
-composer-${{ hashFiles('composer.json') }}
restore-keys: |
php-${{ matrix.php-versions }}
-typo3-${{ matrix.typo3-versions.typo3 }}
-testing-${{ matrix.typo3-versions.testing }}composer-
php-${{ matrix.php-versions }}-typo3-
- name: "Install composer dependencies"
run: composer require typo3/minimal
"^${{ matrix.typo3-versions.typo3 }}"
typo3/testing-framework "^${{ matrix.typo3-versions.testing }}"
--prefer-dist --no-progress --no-suggest

- name: "Run Unit tests"
run: composer run-script test-unit
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
.DS_Store

/vendor/
*.iml
.php_cs.cache
.idea/
.Build/
public/
vendor/
composer.lock
**/.phpunit.result.cache
78 changes: 78 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php


/**
* 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
*
* $ php-cs-fixer fix
*
* For more information read:
* http://www.php-fig.org/psr/psr-2/
* http://cs.sensiolabs.org
*/

if (PHP_SAPI !== 'cli') {
die('This script supports command line usage only. Please check your command.');
}

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@DoctrineAnnotation' => true,
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'cast_spaces' => ['space' => 'none'],
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'],
'dir_constant' => true,
'function_typehint_space' => true,
'general_phpdoc_annotation_remove' => [
'author'
],
'hash_to_slash_comment' => true,
'lowercase_cast' => true,
'modernize_types_casting' => true,
'native_function_casing' => true,
'no_alias_functions' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_consecutive_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,
'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'],
'self_accessor' => true,
'single_quote' => true,
'whitespace_after_comma_in_array' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('.build')
->exclude('var')
->exclude('public')
->in(__DIR__)
);
Loading

0 comments on commit a41103e

Please sign in to comment.