Skip to content
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

Init #1

Merged
merged 25 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e0244cf
Init commit
Mar 10, 2024
163c9a9
Refactor UnitFacing rule to accept specific values. Add unit facing o…
Mar 10, 2024
871c935
Refactor CSV and schema file paths in the test cases.
Mar 10, 2024
a40d4cf
Refactor CSV structure definition and validation rules
Mar 10, 2024
14a7c6b
Refactor IsUuid4 class name and add test for IsUuid4 validator.
Mar 10, 2024
08c8596
Add CSV schema examples to README.md and update dependencies in compo…
Mar 10, 2024
a63e1d4
Add spoiler functionality to README.md
Mar 10, 2024
c3382b8
Update readme: Add more descriptive titles for examples and file form…
Mar 10, 2024
8dcaed9
Refactor CSV schema column rules' YAML and JSON representations
Mar 10, 2024
a7fc230
Refactor CSV validation methods
Mar 10, 2024
ae75c74
Refactor CsvFile constructor and add additional methods to ErrorSuite
Mar 10, 2024
bfcbcfa
Add support for rendering errors as a plain list.
Mar 10, 2024
e646c1b
Fix typo in file paths in MiscTest.php tests
Mar 10, 2024
8daa1fe
Validate CSV file by applying schema rules. If errors are found, disp…
Mar 10, 2024
94179dc
Refactor workflows to focus on demos
Mar 10, 2024
f0a9c13
Fix typo in Makefile command and update PHP version to 8.3 in workflo…
Mar 10, 2024
35001b8
Refactor workflow file for better readability and maintenance
Mar 10, 2024
c53f7bf
Refactor Makefile to add support for ANSI output in demo-github task
Mar 10, 2024
c57d003
Refactor makefile build command for consistent output
Mar 10, 2024
56edbc9
Update PHP array format in README and test case for PHP format in Blu…
Mar 10, 2024
ea82d7d
PHPStan fixed!
Mar 10, 2024
b20e4eb
PHPStan fixed!
Mar 10, 2024
8592314
Phan fixed!
Mar 10, 2024
36fa39e
Codestyle!
Mar 10, 2024
7e41368
Codestyle!
Mar 10, 2024
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
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
Loading
Loading