Skip to content

Commit

Permalink
Init (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis committed Mar 10, 2024
1 parent 199b19e commit c95a9ad
Show file tree
Hide file tree
Showing 84 changed files with 13,616 additions and 2 deletions.
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# JBZoo Toolbox - Csv-Blueprint.
#
# This file is part of the JBZoo Toolbox project.
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
# @license MIT
# @copyright Copyright (C) JBZoo.com, All rights reserved.
# @see https://github.com/JBZoo/Csv-Blueprint
#

# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
33 changes: 33 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# JBZoo Toolbox - Csv-Blueprint.
#
# This file is part of the JBZoo Toolbox project.
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
# @license MIT
# @copyright Copyright (C) JBZoo.com, All rights reserved.
# @see https://github.com/JBZoo/Csv-Blueprint
#

/.github export-ignore
/build export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.phan.php export-ignore
/.travis.yml export-ignore
/composer.lock export-ignore
/phpunit.xml.dist export-ignore
/Makefile export-ignore

* text eol=lf

# (binary is a macro for -text -diff)
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.ttf binary
68 changes: 68 additions & 0 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#
# JBZoo Toolbox - Csv-Blueprint.
#
# This file is part of the JBZoo Toolbox project.
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
# @license MIT
# @copyright Copyright (C) JBZoo.com, All rights reserved.
# @see https://github.com/JBZoo/Csv-Blueprint
#

name: Demo

on:
pull_request:
branches:
- "*"
push:
branches:
- 'master'

env:
COLUMNS: 120
TERM_PROGRAM: Hyper

jobs:
pure-php:
name: Pure PHP
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
tools: composer

- name: Build the Project
run: make update

- name: Validate CSV (default is table)
run: make demo-github
continue-on-error: true

- name: Validate CSV (text)
run: OUTPUT=text make demo-github
continue-on-error: true

- name: Validate CSV (github)
run: OUTPUT=github make demo-github
continue-on-error: true

- name: Validate CSV (gitlab)
run: OUTPUT=gitlab make demo-github
continue-on-error: true

- name: Validate CSV (teamcity)
run: OUTPUT=teamcity make demo-github
continue-on-error: true

- name: Validate CSV (junit)
run: OUTPUT=junit make demo-github
continue-on-error: true
140 changes: 140 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
#
# JBZoo Toolbox - Csv-Blueprint.
#
# This file is part of the JBZoo Toolbox project.
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
# @license MIT
# @copyright Copyright (C) JBZoo.com, All rights reserved.
# @see https://github.com/JBZoo/Csv-Blueprint
#

name: CI

on:
pull_request:
branches:
- "*"
push:
branches:
- 'master'
schedule:
- cron: '12 */8 * * *'

env:
COLUMNS: 120
TERM_PROGRAM: Hyper

jobs:
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
env:
JBZOO_COMPOSER_UPDATE_FLAGS: ${{ matrix.composer_flags }}
strategy:
matrix:
php-version: [ 8.1, 8.2, 8.3 ]
coverage: [ xdebug, none ]
composer_flags: [ "--prefer-lowest", "" ]
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: ${{ matrix.coverage }}
tools: composer
extensions: ast

- name: Build the Project
run: make update --no-print-directory

- name: 🧪 PHPUnit Tests
run: make test --no-print-directory

- name: Uploading coverage to coveralls
if: ${{ matrix.coverage == 'xdebug' }}
continue-on-error: true
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make report-coveralls --no-print-directory || true

- name: Upload Artifacts
uses: actions/upload-artifact@v3
continue-on-error: true
with:
name: PHPUnit - ${{ matrix.php-version }} - ${{ matrix.coverage }}
path: build/


linters:
name: Linters
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ 8.1, 8.2, 8.3 ]
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
tools: composer
extensions: ast

- name: Build the Project
run: make update --no-print-directory

- name: 👍 Code Quality
run: make codestyle --no-print-directory

- name: Upload Artifacts
uses: actions/upload-artifact@v3
continue-on-error: true
with:
name: Linters - ${{ matrix.php-version }}
path: build/


report:
name: Reports
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ 8.1, 8.2, 8.3 ]
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug
tools: composer
extensions: ast

- name: Build the Project
run: make update --no-print-directory

- name: 📝 Build Reports
run: make report-all --no-print-directory

- name: Upload Artifacts
uses: actions/upload-artifact@v3
continue-on-error: true
with:
name: Reports - ${{ matrix.php-version }}
path: build/
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# JBZoo Toolbox - Csv-Blueprint.
#
# This file is part of the JBZoo Toolbox project.
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
# @license MIT
# @copyright Copyright (C) JBZoo.com, All rights reserved.
# @see https://github.com/JBZoo/Csv-Blueprint
#

.idea
.DS_Store
build
vendor
phpunit.xml
*.cache
34 changes: 34 additions & 0 deletions .phan.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

/**
* JBZoo Toolbox - Csv-Blueprint.
*
* This file is part of the JBZoo Toolbox project.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT
* @copyright Copyright (C) JBZoo.com, All rights reserved.
* @see https://github.com/JBZoo/Csv-Blueprint
*/

declare(strict_types=1);

$default = include __DIR__ . '/vendor/jbzoo/codestyle/src/phan.php';

// Remove SimplifyExpressionPlugin from plugin list
$default['plugins'] = \array_diff($default['plugins'], ['SimplifyExpressionPlugin']);

return \array_merge($default, [
'directory_list' => [
'src',

'vendor/jbzoo/data/src',
'vendor/jbzoo/cli/src',
'vendor/jbzoo/utils/src',
'vendor/jbzoo/ci-report-converter/src',
'vendor/league/csv/src',
'vendor/fakerphp/faker/src',
'vendor/symfony/console',
],
]);
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 JBZoo Toolbox
Copyright (c) 2020 JBZoo Toolbox for developers

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
55 changes: 55 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#
# JBZoo Toolbox - Csv-Blueprint.
#
# This file is part of the JBZoo Toolbox project.
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
# @license MIT
# @copyright Copyright (C) JBZoo.com, All rights reserved.
# @see https://github.com/JBZoo/Csv-Blueprint
#


ifneq (, $(wildcard ./vendor/jbzoo/codestyle/src/init.Makefile))
include ./vendor/jbzoo/codestyle/src/init.Makefile
endif

OUTPUT ?= table

update: ##@Project Install/Update all 3rd party dependencies
$(call title,"Install/Update all 3rd party dependencies")
@echo "Composer flags: $(JBZOO_COMPOSER_UPDATE_FLAGS)"
@composer update $(JBZOO_COMPOSER_UPDATE_FLAGS)


test-all: ##@Project Run all project tests at once
@make test
@make codestyle


demo-valid: ##@Project Run demo valid CSV
$(call title,"Demo - Valid CSV")
@${PHP_BIN} ./csv-blueprint validate:csv \
--csv=./tests/fixtures/demo.csv \
--schema=./tests/schemas/demo_valid.yml


demo-invalid: ##@Project Run demo invalid CSV
$(call title,"Demo - Invalid CSV")
@${PHP_BIN} ./csv-blueprint validate:csv \
--csv=./tests/fixtures/demo.csv \
--schema=./tests/schemas/demo_invalid.yml


demo-github: ##@Project Run demo invalid CSV
@${PHP_BIN} ./csv-blueprint validate:csv \
--csv=./tests/fixtures/demo.csv \
--schema=./tests/schemas/demo_invalid.yml \
--output=$(OUTPUT) \
--ansi


demo: ##@Project Run all demo commands
@make demo-valid
@make demo-invalid

0 comments on commit c95a9ad

Please sign in to comment.