diff --git a/README.md b/README.md index 0e1ac5e..43bdf5b 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,9 @@ Most of the configuration should be available in the inventory. It is launched usually like this : `ansible-playbook site.yml` -## Prerequisite +## Prerequisites +### Prerequisites for the Jenkins hosts Hosts should be accessible via SSH as the root user (else, add the usual `remote_user`/`become` instructions in ansible.cfg) and with the Python prerequisite of Ansible (usually `python-minimal`). @@ -26,6 +27,18 @@ ansible foo.bar.com -m ping ansible-playbook -l foo.bar.com -v -C -D site.yml ``` +### Prerequisites for the repositories +None at the moment : this playbook will not configure Gitea or anything +else outside Jenkins. The webhooks and the access to allow Jenkins to +clone/pull the repositories are to be done manually (a recap will be +displayed at the end of the playbook). + +### Prerequisites for the projects +Nothing mandatory except the [`build.xml`](http://jenkins-php.org/automation.html) +file at the root of each project. + +See examples in the `roles/jenkins-php-v1/files/skeletons/' directory. + ## Directory layout We follow (more or less) the recommendations of @@ -51,4 +64,4 @@ adapt. ## License -[CC-BY-SA 3.0](http://creativecommons.org/licenses/by-sa/3.0/) like http://jenkins-php.org/ +[CC-BY-SA 3.0](http://creativecommons.org/licenses/by-sa/3.0/) like http://jenkins-php.org/ by [Sebastian Bergmann](http://sebastian-bergmann.de/) and his contributors. diff --git a/roles/jenkins-php-v1/files/skeletons/laravel5.5/build.xml b/roles/jenkins-php-v1/files/skeletons/laravel5.5/build.xml new file mode 100644 index 0000000..2783f2a --- /dev/null +++ b/roles/jenkins-php-v1/files/skeletons/laravel5.5/build.xml @@ -0,0 +1,272 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/roles/jenkins-php-v1/files/skeletons/laravel5.5/build/phpcs.xml b/roles/jenkins-php-v1/files/skeletons/laravel5.5/build/phpcs.xml new file mode 100644 index 0000000..7aad65d --- /dev/null +++ b/roles/jenkins-php-v1/files/skeletons/laravel5.5/build/phpcs.xml @@ -0,0 +1,11 @@ + + +The PSR2 coding standard. + +../app/ +vendor +resources +database/ +storage/ +node_modules/ + diff --git a/roles/jenkins-php-v1/files/skeletons/laravel5.5/build/phpdox.xml b/roles/jenkins-php-v1/files/skeletons/laravel5.5/build/phpdox.xml new file mode 100644 index 0000000..8552ed6 --- /dev/null +++ b/roles/jenkins-php-v1/files/skeletons/laravel5.5/build/phpdox.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/roles/jenkins-php-v1/files/skeletons/laravel5.5/build/phpmd.xml b/roles/jenkins-php-v1/files/skeletons/laravel5.5/build/phpmd.xml new file mode 100644 index 0000000..5b5acbb --- /dev/null +++ b/roles/jenkins-php-v1/files/skeletons/laravel5.5/build/phpmd.xml @@ -0,0 +1,18 @@ + + + + My custom rule set that checks my code... + + + + + + + + diff --git a/roles/jenkins-php-v1/files/skeletons/laravel5.5/build/phpunit.xml b/roles/jenkins-php-v1/files/skeletons/laravel5.5/build/phpunit.xml new file mode 100644 index 0000000..6235c16 --- /dev/null +++ b/roles/jenkins-php-v1/files/skeletons/laravel5.5/build/phpunit.xml @@ -0,0 +1,37 @@ + + + + + ../tests/Feature + + + + ../tests/Unit + + + + + ../app + + + + + + + + + + + + + + + diff --git a/roles/jenkins-php-v1/files/skeletons/laravel5.5/git_hooks_pre-commit b/roles/jenkins-php-v1/files/skeletons/laravel5.5/git_hooks_pre-commit new file mode 100755 index 0000000..0312fe3 --- /dev/null +++ b/roles/jenkins-php-v1/files/skeletons/laravel5.5/git_hooks_pre-commit @@ -0,0 +1,58 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# Stop at any uncatched non-zero status +set -e + +# If there are whitespace errors, print the offending file names and fail. +git diff-index --check --cached $against -- + +# PHP checks +echo "Checking PHP syntax (linting)..." +git diff-index --diff-filter=ACMRT --cached --name-only HEAD -- | egrep '\.php$|\.inc$' | xargs --no-run-if-empty -d "\n" -n 1 php -l +echo "Checking PHP CodeStyle..." +git diff-index --diff-filter=ACMRT --cached --name-only HEAD -- | egrep '\.php$|\.inc$' | xargs --no-run-if-empty -d "\n" phpcs --standard=build/phpcs.xml --extensions=php --ignore=autoload.php --ignore=bootstrap/cache/