Skip to content

Commit f739a3f

Browse files
committed
init
1 parent ad330a0 commit f739a3f

25 files changed

+904
-0
lines changed

.gitlab-ci.yml

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
stages:
3+
- tests
4+
- release_publish
5+
- wordpress.org
6+
- github.com
7+
8+
Unit Test:
9+
dependencies: []
10+
image: gitlab.krone.at:5000/krn/backend:beta
11+
tags:
12+
- docker
13+
services:
14+
- mysql:5.7
15+
stage: tests
16+
variables:
17+
# Configure mysql environment variables (https://hub.docker.com/r/_/mysql/)
18+
MYSQL_ROOT_PASSWORD: somepw
19+
script:
20+
- composer update
21+
- echo "zend_extension=xdebug.so" > /usr/local/etc/php/conf.d/xdebug.ini
22+
- bin/install-wp-tests.sh wordpress_test root 'somepw' mysql latest
23+
- composer update
24+
- phpunit --colors=always --coverage-text=1.txt
25+
- grep "Lines:" 1.txt
26+
except:
27+
- /^v.*/ # do not unit test release tags
28+
- after_build
29+
- after_build_beta
30+
31+
32+
tests:phpcs:
33+
image: gitlab.krone.at:5000/krn/docker_base:beta
34+
stage: tests
35+
script:
36+
# Check for var_dump/dump
37+
- export PATH=~/.composer/vendor/bin:$PATH
38+
- php-cs-fixer fix --verbose --dry-run --rules=@PSR2 || true
39+
tags:
40+
- docker
41+
except:
42+
- /^v([0-9]+).*/
43+
44+
tests:phpstan:
45+
image: gitlab.krone.at:5000/krn/docker_base:beta
46+
stage: tests
47+
script:
48+
# Check for var_dump/dump
49+
- export PATH=~/.composer/vendor/bin:$PATH
50+
- phpstan analyse src/ || true
51+
tags:
52+
- docker
53+
except:
54+
- /^v([0-9]+).*/
55+
56+
tests:phpcompatibility:
57+
image: gitlab.krone.at:5000/krn/docker_base:beta
58+
stage: tests
59+
script:
60+
# Check for var_dump/dump
61+
- export PATH=~/.composer/vendor/bin:$PATH
62+
- phpcs -p src --standard=PHPCompatibility --extensions=php
63+
- phpcs -p tests --standard=PHPCompatibility --extensions=php
64+
tags:
65+
- docker
66+
except:
67+
- /^v([0-9]+).*/
68+
69+
70+
71+
release:publish:
72+
image: gitlab.krone.at:5000/krn/fastlane_runner:latest
73+
dependencies: []
74+
stage: release_publish
75+
script:
76+
- fastlane publish_release
77+
tags:
78+
- docker
79+
artifacts:
80+
paths:
81+
- latest_release.txt
82+
only:
83+
- release
84+
- fastlane
85+
- beta
86+
- master
87+
88+
#svn update:
89+
# image: gitlab.krone.at:5000/krn/backend:beta
90+
# dependencies: ["release:publish"]
91+
# stage: wordpress.org
92+
# script:
93+
# - bin/deploy-to-wp.sh $(cat latest_release.txt) kmm-hacks
94+
# tags:
95+
# - docker
96+
# only:
97+
# - master
98+
99+
100+
101+
before_script:
102+
- eval $(ssh-agent -s)
103+
- ssh-add <(echo "$SSH_DEPLOY_KEY")

.gitmodules

Whitespace-only changes.

.php_cs

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?php
2+
$config = PhpCsFixer\Config::create();
3+
$config->setRiskyAllowed(true);
4+
$config->setRules([
5+
'@PSR2' => true,
6+
'array_syntax' => [
7+
'syntax' => 'short',
8+
],
9+
'binary_operator_spaces' => [
10+
'align_double_arrow' => false,
11+
'align_equals' => false,
12+
],
13+
'blank_line_after_namespace' => true,
14+
'blank_line_after_opening_tag' => true,
15+
'blank_line_before_statement' => ['statements' => ['return']],
16+
'concat_space' => ['spacing' => 'one'],
17+
'function_typehint_space' => true,
18+
'lowercase_cast' => true,
19+
'method_separation' => true,
20+
'native_function_casing' => true,
21+
'new_with_braces' => true,
22+
'no_empty_comment' => true,
23+
'no_empty_phpdoc' => true,
24+
'no_empty_statement' => true,
25+
'no_extra_consecutive_blank_lines' => [
26+
'tokens' => [
27+
'curly_brace_block',
28+
'extra',
29+
'parenthesis_brace_block',
30+
'square_brace_block',
31+
'throw',
32+
'use',
33+
],
34+
],
35+
'no_leading_import_slash' => true,
36+
'no_leading_namespace_whitespace' => true,
37+
'no_multiline_whitespace_around_double_arrow' => true,
38+
'no_short_bool_cast' => true,
39+
'no_singleline_whitespace_before_semicolons' => true,
40+
'no_trailing_comma_in_singleline_array' => true,
41+
'no_unneeded_control_parentheses' => true,
42+
'no_unused_imports' => true,
43+
'no_whitespace_before_comma_in_array' => true,
44+
'no_whitespace_in_blank_line' => true,
45+
'normalize_index_brace' => true,
46+
'not_operator_with_successor_space' => true,
47+
'object_operator_without_whitespace' => true,
48+
'ordered_imports' => true,
49+
'php_unit_construct' => true,
50+
'php_unit_dedicate_assert' => true,
51+
'phpdoc_single_line_var_spacing' => true,
52+
'phpdoc_trim' => true,
53+
'pre_increment' => true,
54+
'psr4' => true,
55+
'random_api_migration' => true,
56+
'self_accessor' => true,
57+
'short_scalar_cast' => true,
58+
'single_blank_line_before_namespace' => true,
59+
'single_class_element_per_statement' => true,
60+
'single_quote' => true,
61+
'space_after_semicolon' => true,
62+
'standardize_not_equals' => true,
63+
'ternary_operator_spaces' => true,
64+
'trailing_comma_in_multiline_array' => true,
65+
'trim_array_spaces' => true,
66+
'unary_operator_spaces' => true,
67+
'whitespace_after_comma_in_array' => true,
68+
]);
69+
$finder = PhpCsFixer\Finder::create();
70+
$finder->in([
71+
'src'
72+
]);
73+
$config->setFinder($finder);
74+
return $config;

.scrutinizer.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
checks:
2+
php: true
3+
4+
coding_style:
5+
php:
6+
spaces:
7+
around_operators:
8+
concatenation: true
9+
negation: true
10+
other:
11+
after_type_cast: false
12+
13+
tools:
14+
external_code_coverage: true
15+
16+
php_code_sniffer:
17+
config:
18+
standard: "PSR2"
19+
20+
filter:
21+
excluded_paths:
22+
- tests/*
23+
- examples/*

.travis.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
language: php
2+
sudo: false
3+
dist: trusty
4+
5+
stages:
6+
- test
7+
- style
8+
- coverage
9+
- deploy
10+
11+
12+
env:
13+
- WP_VERSION=latest
14+
- WP_VERSION=trunk
15+
php:
16+
- 7.2
17+
- 7.1
18+
19+
services:
20+
- mysql
21+
22+
cache:
23+
directories:
24+
- $HOME/.composer/cache/files
25+
26+
before_install:
27+
- phpenv config-rm xdebug.ini
28+
- composer self-update
29+
- composer global require hirak/prestissimo
30+
- bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 $WP_VERSION
31+
- travis_retry travis_wait composer install --no-interaction
32+
33+
34+
# travis launches phpunit itself in the testing stage according to php setups
35+
# test stage script
36+
script:
37+
- vendor/phpunit/phpunit/phpunit -v --colors=always
38+
39+
40+
jobs:
41+
include:
42+
- stage: style
43+
script:
44+
- composer cs-check
45+
env: CS-FIXER=true
46+
47+
- stage: coverage
48+
php: 7.1
49+
script:
50+
- phpdbg -qrr vendor/bin/phpunit --coverage-clover clover.xml
51+
after_success:
52+
- vendor/bin/ocular code-coverage:upload --format=php-clover clover.xml --revision=$TRAVIS_COMMIT
53+

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# plugin-hacks
2+

assets/screenshot-1.png

137 KB
Loading

assets/screenshot-2.png

128 KB
Loading

assets/screenshot-3.png

83.7 KB
Loading

bin/deploy-to-wp.sh

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
3+
set -x
4+
5+
# Install the dependencies (as defined in the composer.lock) first so we can package them up
6+
composer install --no-dev --optimize-autoloader --no-interaction
7+
8+
9+
10+
11+
version=$1
12+
KRN_REPO_SLUG=$2
13+
14+
apt-get update -y
15+
apt-get install -y rsync
16+
17+
sed -i "s/v9.9.9/$version/g" ${KRN_REPO_SLUG}.php
18+
19+
# Cleanup the old dir if it is there
20+
rm -rf /tmp/tmp_folder-svn
21+
22+
# Checkout the svn repo
23+
svn co http://plugins.svn.wordpress.org/$KRN_REPO_SLUG/ /tmp/tmp_folder-svn
24+
25+
echo "Copying files to trunk"
26+
rsync -Rrd --delete ./ /tmp/tmp_folder-svn/trunk/
27+
28+
cd /tmp/tmp_folder-svn/
29+
30+
rm -vfr trunk/.git
31+
svn status | grep '^!' | awk '{print $2}' | xargs svn delete
32+
svn add --force * --auto-props --parents --depth infinity -q
33+
34+
svn status
35+
36+
svn commit --username $WP_ORG_USERNAME --password $WP_ORG_PASSWORD --no-auth-cache -m "Syncing v${version}"
37+
38+
echo "Creating release tag"
39+
40+
mkdir /tmp/tmp_folder-svn/tags/${version}
41+
svn add /tmp/tmp_folder-svn/tags/${version}
42+
svn commit --username $WP_ORG_USERNAME --password $WP_ORG_PASSWORD -m "Creating tag for v${version}"
43+
44+
echo "Copying versioned files to v${version} tag"
45+
46+
svn cp --parents trunk/* tags/${version}
47+
48+
svn commit --username $WP_ORG_USERNAME --password $WP_ORG_PASSWORD -m "Tagging v${version}"
49+

0 commit comments

Comments
 (0)