Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
hjanuschka committed Aug 3, 2018
1 parent ad330a0 commit f739a3f
Show file tree
Hide file tree
Showing 25 changed files with 904 additions and 0 deletions.
103 changes: 103 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
stages:
- tests
- release_publish
- wordpress.org
- github.com

Unit Test:
dependencies: []
image: gitlab.krone.at:5000/krn/backend:beta
tags:
- docker
services:
- mysql:5.7
stage: tests
variables:
# Configure mysql environment variables (https://hub.docker.com/r/_/mysql/)
MYSQL_ROOT_PASSWORD: somepw
script:
- composer update
- echo "zend_extension=xdebug.so" > /usr/local/etc/php/conf.d/xdebug.ini
- bin/install-wp-tests.sh wordpress_test root 'somepw' mysql latest
- composer update
- phpunit --colors=always --coverage-text=1.txt
- grep "Lines:" 1.txt
except:
- /^v.*/ # do not unit test release tags
- after_build
- after_build_beta


tests:phpcs:
image: gitlab.krone.at:5000/krn/docker_base:beta
stage: tests
script:
# Check for var_dump/dump
- export PATH=~/.composer/vendor/bin:$PATH
- php-cs-fixer fix --verbose --dry-run --rules=@PSR2 || true
tags:
- docker
except:
- /^v([0-9]+).*/

tests:phpstan:
image: gitlab.krone.at:5000/krn/docker_base:beta
stage: tests
script:
# Check for var_dump/dump
- export PATH=~/.composer/vendor/bin:$PATH
- phpstan analyse src/ || true
tags:
- docker
except:
- /^v([0-9]+).*/

tests:phpcompatibility:
image: gitlab.krone.at:5000/krn/docker_base:beta
stage: tests
script:
# Check for var_dump/dump
- export PATH=~/.composer/vendor/bin:$PATH
- phpcs -p src --standard=PHPCompatibility --extensions=php
- phpcs -p tests --standard=PHPCompatibility --extensions=php
tags:
- docker
except:
- /^v([0-9]+).*/



release:publish:
image: gitlab.krone.at:5000/krn/fastlane_runner:latest
dependencies: []
stage: release_publish
script:
- fastlane publish_release
tags:
- docker
artifacts:
paths:
- latest_release.txt
only:
- release
- fastlane
- beta
- master

#svn update:
# image: gitlab.krone.at:5000/krn/backend:beta
# dependencies: ["release:publish"]
# stage: wordpress.org
# script:
# - bin/deploy-to-wp.sh $(cat latest_release.txt) kmm-hacks
# tags:
# - docker
# only:
# - master



before_script:
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_DEPLOY_KEY")
Empty file added .gitmodules
Empty file.
74 changes: 74 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php
$config = PhpCsFixer\Config::create();
$config->setRiskyAllowed(true);
$config->setRules([
'@PSR2' => true,
'array_syntax' => [
'syntax' => 'short',
],
'binary_operator_spaces' => [
'align_double_arrow' => false,
'align_equals' => false,
],
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => ['statements' => ['return']],
'concat_space' => ['spacing' => 'one'],
'function_typehint_space' => true,
'lowercase_cast' => true,
'method_separation' => true,
'native_function_casing' => true,
'new_with_braces' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => [
'tokens' => [
'curly_brace_block',
'extra',
'parenthesis_brace_block',
'square_brace_block',
'throw',
'use',
],
],
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_control_parentheses' => true,
'no_unused_imports' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'normalize_index_brace' => true,
'not_operator_with_successor_space' => true,
'object_operator_without_whitespace' => true,
'ordered_imports' => true,
'php_unit_construct' => true,
'php_unit_dedicate_assert' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_trim' => true,
'pre_increment' => true,
'psr4' => true,
'random_api_migration' => true,
'self_accessor' => true,
'short_scalar_cast' => true,
'single_blank_line_before_namespace' => true,
'single_class_element_per_statement' => true,
'single_quote' => true,
'space_after_semicolon' => true,
'standardize_not_equals' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'whitespace_after_comma_in_array' => true,
]);
$finder = PhpCsFixer\Finder::create();
$finder->in([
'src'
]);
$config->setFinder($finder);
return $config;
23 changes: 23 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
checks:
php: true

coding_style:
php:
spaces:
around_operators:
concatenation: true
negation: true
other:
after_type_cast: false

tools:
external_code_coverage: true

php_code_sniffer:
config:
standard: "PSR2"

filter:
excluded_paths:
- tests/*
- examples/*
53 changes: 53 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
language: php
sudo: false
dist: trusty

stages:
- test
- style
- coverage
- deploy


env:
- WP_VERSION=latest
- WP_VERSION=trunk
php:
- 7.2
- 7.1

services:
- mysql

cache:
directories:
- $HOME/.composer/cache/files

before_install:
- phpenv config-rm xdebug.ini
- composer self-update
- composer global require hirak/prestissimo
- bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 $WP_VERSION
- travis_retry travis_wait composer install --no-interaction


# travis launches phpunit itself in the testing stage according to php setups
# test stage script
script:
- vendor/phpunit/phpunit/phpunit -v --colors=always


jobs:
include:
- stage: style
script:
- composer cs-check
env: CS-FIXER=true

- stage: coverage
php: 7.1
script:
- phpdbg -qrr vendor/bin/phpunit --coverage-clover clover.xml
after_success:
- vendor/bin/ocular code-coverage:upload --format=php-clover clover.xml --revision=$TRAVIS_COMMIT

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# plugin-hacks

Binary file added assets/screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions bin/deploy-to-wp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

set -x

# Install the dependencies (as defined in the composer.lock) first so we can package them up
composer install --no-dev --optimize-autoloader --no-interaction




version=$1
KRN_REPO_SLUG=$2

apt-get update -y
apt-get install -y rsync

sed -i "s/v9.9.9/$version/g" ${KRN_REPO_SLUG}.php

# Cleanup the old dir if it is there
rm -rf /tmp/tmp_folder-svn

# Checkout the svn repo
svn co http://plugins.svn.wordpress.org/$KRN_REPO_SLUG/ /tmp/tmp_folder-svn

echo "Copying files to trunk"
rsync -Rrd --delete ./ /tmp/tmp_folder-svn/trunk/

cd /tmp/tmp_folder-svn/

rm -vfr trunk/.git
svn status | grep '^!' | awk '{print $2}' | xargs svn delete
svn add --force * --auto-props --parents --depth infinity -q

svn status

svn commit --username $WP_ORG_USERNAME --password $WP_ORG_PASSWORD --no-auth-cache -m "Syncing v${version}"

echo "Creating release tag"

mkdir /tmp/tmp_folder-svn/tags/${version}
svn add /tmp/tmp_folder-svn/tags/${version}
svn commit --username $WP_ORG_USERNAME --password $WP_ORG_PASSWORD -m "Creating tag for v${version}"

echo "Copying versioned files to v${version} tag"

svn cp --parents trunk/* tags/${version}

svn commit --username $WP_ORG_USERNAME --password $WP_ORG_PASSWORD -m "Tagging v${version}"

Loading

0 comments on commit f739a3f

Please sign in to comment.