Skip to content

initial-release #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
version: 2.1

orbs:
ci-caching: jobcloud/ci-caching@1.0.2
ci-php: jobcloud/ci-php@0.32

workflows:
test-php-simple-kafka-lib:
jobs:
- ci-caching/build-docker-images:
dockerComposeFile: "./docker/docker-compose.yml"
- ci-php/install-dependencies:
dockerComposeFile: "./docker/docker-compose.yml"
dependencyCheckSumFile: "./composer.json"
requires:
- ci-caching/build-docker-images
- coverage:
requires:
- ci-php/install-dependencies
- ci-php/code-style:
dockerComposeFile: "./docker/docker-compose.yml"
dependencyCheckSumFile: "./composer.json"
requires:
- ci-php/install-dependencies
- ci-php/static-analysis:
dockerComposeFile: "./docker/docker-compose.yml"
dependencyCheckSumFile: "./composer.json"
requires:
- ci-php/install-dependencies
- ci-php/infection-testing:
dockerComposeFile: "./docker/docker-compose.yml"
dependencyCheckSumFile: "./composer.json"
requires:
- ci-php/install-dependencies

jobs:
coverage:
machine: true
steps:
- ci-php/coverage-command:
dockerComposeFile: "./docker/docker-compose.yml"
dependencyCheckSumFile: "./composer.json"
- run:
name: Download cc-test-reporter
command: |
mkdir -p tmp/
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./tmp/cc-test-reporter
chmod +x ./tmp/cc-test-reporter
- run:
name: Upload coverage results to Code Climate
command: |
./tmp/cc-test-reporter after-build -p /var/www/html --coverage-input-type clover --exit-code $?
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: [nick-zh]
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--
Please always include the following in an issue:
-->

* PHP version:
* simple-kafka-client version:
* php-simple-kafka-lib version:
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/build/
/vendor/
/.idea
/composer.symlink
composer.lock
.phpunit.result.cache
clover.xml
31 changes: 31 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
BSD 3-Clause License

Copyright (c) 2019 JobCloud AG
Copyright (c) 2021, Nick Chiu
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

65 changes: 65 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
.PHONY: clean code-style coverage help test static-analysis install-dependencies install-dependencies-lowest update-dependencies pcov-enable pcov-disable infection-testing
.DEFAULT_GOAL := test

PHPUNIT = ./vendor/bin/phpunit -c ./phpunit.xml
PHPSTAN = ./vendor/bin/phpstan
PHPCS = ./vendor/bin/phpcs --extensions=php
CONSOLE = ./bin/console
INFECTION = ./vendor/bin/infection

clean:
rm -rf ./build ./vendor

code-style: pcov-disable
mkdir -p build/logs/phpcs
${PHPCS} --report-full --report-gitblame --standard=PSR12 ./src --exclude=Generic.Commenting.Todo --report-junit=build/logs/phpcs/junit.xml

coverage: pcov-enable
${PHPUNIT} && ./vendor/bin/coverage-check clover.xml 100

test: pcov-disable
${PHPUNIT}

static-analysis: pcov-disable
mkdir -p build/logs/phpstan
${PHPSTAN} analyse --no-progress --memory-limit=64

update-dependencies:
composer update

install-dependencies:
composer install

install-dependencies-lowest:
composer install --prefer-lowest

infection-testing:
make coverage
cp -f build/logs/phpunit/junit.xml build/logs/phpunit/coverage/junit.xml
sudo php-ext-disable pcov
${INFECTION} --coverage=build/logs/phpunit/coverage --min-msi=93 --threads=`nproc`
sudo php-ext-enable pcov

pcov-enable:
sudo php-ext-enable pcov

pcov-disable:
sudo php-ext-disable pcov

help:
# Usage:
# make <target> [OPTION=value]
#
# Targets:
# clean Cleans the coverage and the vendor directory
# code-style Check codestyle using phpcs
# coverage Generate code coverage (html, clover)
# help You're looking at it!
# test (default) Run all the tests with phpunit
# static-analysis Run static analysis using phpstan
# infection-testing Run infection/mutation testing
# install-dependencies Run composer install
# install-dependencies-lowest Run composer install with --prefer-lowest
# update-dependencies Run composer update
# pcov-enable Enable pcov
# pcov-disable Disable pcov
Loading