Skip to content

Commit

Permalink
Merge 8554aac into 7f71221
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis committed Mar 13, 2024
2 parents 7f71221 + 8554aac commit 4defc44
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 98 deletions.
66 changes: 4 additions & 62 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ jobs:
--rm jbzoo/csv-blueprint \
validate:csv \
--csv=/parent-host/tests/fixtures/batch/*.csv \
--schema=/parent-host/tests/schemas/demo_valid.yml
--schema=/parent-host/tests/schemas/demo_valid.yml \
--ansi
- name: 👎 Invalid CSV file
run: |
Expand All @@ -110,64 +111,5 @@ jobs:
--rm jbzoo/csv-blueprint \
validate:csv \
--csv=/parent-host/tests/fixtures/batch/*.csv \
--schema=/parent-host/tests/schemas/demo_invalid.yml
phar:
name: Phar
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

- name: Build the project
run: make build --no-print-directory

- name: 👍 Valid CSV file
run: |
./build/csv-blueprint.phar \
validate:csv \
--csv=./tests/fixtures/batch/*.csv \
--schema=./tests/schemas/demo_valid.yml
- name: 👎 Invalid CSV file
run: |
! ./build/csv-blueprint.phar \
validate:csv \
--csv=./tests/fixtures/batch/*.csv \
--schema=./tests/schemas/demo_invalid.yml
php:
name: Pure PHP
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

- name: Build the Project
run: make build-install --no-print-directory

- name: 👍 Valid CSV file
run: |
./csv-blueprint \
validate:csv \
--csv=./tests/fixtures/batch/*.csv \
--schema=./tests/schemas/demo_valid.yml
- name: 👎 Invalid CSV file
run: |
! ./csv-blueprint \
validate:csv \
--csv=./tests/fixtures/batch/*.csv \
--schema=./tests/schemas/demo_invalid.yml
--schema=/parent-host/tests/schemas/demo_invalid.yml \
--ansi
87 changes: 72 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,35 +139,76 @@ jobs:
name: Reports - ${{ matrix.php-version }}
path: build/

phar:
name: Phar

test-php-binary:
name: Verify PHP binary
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

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

- name: Build the Project
run: make build-install --no-print-directory

- name: 👍 Valid CSV file
run: |
./csv-blueprint \
validate:csv \
--csv=./tests/fixtures/batch/*.csv \
--schema=./tests/schemas/demo_valid.yml
- name: 👎 Invalid CSV file
run: |
! ./csv-blueprint \
validate:csv \
--csv=./tests/fixtures/batch/*.csv \
--schema=./tests/schemas/demo_invalid.yml
test-phar:
name: Verify PHAR
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 build --no-print-directory

- name: Building Phar binary file
run: make build-phar --no-print-directory

- name: Trying to use the phar file
- name: Test help and logo
run: ./build/csv-blueprint.phar

- name: 👍 Valid CSV file
run: |
./build/csv-blueprint.phar \
validate:csv \
--csv=./tests/fixtures/batch/*.csv \
--schema=./tests/schemas/demo_valid.yml \
--ansi
- name: 👎 Invalid CSV file
run: |
! ./build/csv-blueprint.phar \
validate:csv \
--csv=./tests/fixtures/batch/*.csv \
--schema=./tests/schemas/demo_invalid.yml \
--ansi
- name: Upload Artifacts
uses: actions/upload-artifact@v3
continue-on-error: true
Expand All @@ -177,7 +218,7 @@ jobs:


docker:
name: Docker
name: Verify as Docker
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -186,9 +227,25 @@ jobs:
- name: 🐳 Building Docker Image
run: make build-docker

- name: Trying to use the Docker Image
- name: Test help and logo
run: docker run --rm jbzoo/csv-blueprint --ansi

- name: Reporting example via Docker
run: make demo-docker --no-print-directory
continue-on-error: true
- name: 👍 Valid CSV file
run: |
docker run --rm \
-v `pwd`:/parent-host \
jbzoo/csv-blueprint \
validate:csv \
--csv=/parent-host/tests/fixtures/demo.csv \
--schema=/parent-host/tests/schemas/demo_valid.yml \
--ansi
- name: 👎 Invalid CSV file
run: |
! docker run --rm \
-v `pwd`:/parent-host \
jbzoo/csv-blueprint \
validate:csv \
--csv=/parent-host/tests/fixtures/demo.csv \
--schema=/parent-host/tests/schemas/demo_invalid.yml \
--ansi
25 changes: 4 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,6 @@
[![Stable Version](https://poser.pugx.org/jbzoo/csv-blueprint/version)](https://packagist.org/packages/jbzoo/csv-blueprint/) [![Total Downloads](https://poser.pugx.org/jbzoo/csv-blueprint/downloads)](https://packagist.org/packages/jbzoo/csv-blueprint/stats) [![Docker Pulls](https://img.shields.io/docker/pulls/jbzoo/csv-blueprint.svg)](https://hub.docker.com/r/jbzoo/csv-blueprint) [![Dependents](https://poser.pugx.org/jbzoo/csv-blueprint/dependents)](https://packagist.org/packages/jbzoo/csv-blueprint/dependents?order_by=downloads) [![GitHub License](https://img.shields.io/github/license/jbzoo/csv-blueprint)](https://github.com/JBZoo/Csv-Blueprint/blob/master/LICENSE)



* [Introduction](#introduction)
* [Why validate CSV files in CI?](#why-validate-csv-files-in-ci)
* [Features](#features)
* [Live Demo](#live-demo)
* [Usage](#usage)
* [As GitHub Action](#as-github-action)
* [As Docker container](#as-docker-container)
* [As PHP binary](#as-php-binary)
* [As PHP project](#as-php-project)
* [CLI Help Message](#cli-help-message)
* [Report examples](#report-examples)
* [Schema Definition](#schema-definition)
* [Schema file examples](#schema-file-examples)
* [Coming soon](#coming-soon)
* [Disadvantages?](#disadvantages)
* [Contributing](#contributing)
* [License](#license)
* [See Also](#see-also)


## Introduction

The JBZoo/Csv-Blueprint tool is a powerful and flexible utility designed for validating CSV files against
Expand Down Expand Up @@ -517,6 +496,7 @@ Batch processing

Validation
* [x] ~~`filename_pattern` validation with regex (like "all files in the folder should be in the format `/^[\d]{4}-[\d]{2}-[\d]{2}\.csv$/`").~~
* [ ] Flag to ignore file name pattern. It's useful when you have a lot of files and you don't want to validate the file name.
* [ ] Agregate rules (like "at least one of the fields should be not empty" or "all values must be unique").
* [ ] Handle empty files and files with only a header row, or only with one line of data. One column wthout header is also possible.
* [ ] Using multiple schemas for one csv file.
Expand All @@ -531,6 +511,8 @@ Release workflow
* [ ] Build and release Docker image [via GitHub Actions, tags and labels](https://docs.docker.com/build/ci/github-actions/manage-tags-labels/). Review it.
* [ ] Upgrading to PHP 8.3.x
* [ ] Build phar file and release via GitHub Actions.
* [ ] Auto insert tool version into the Docker image and phar file. It's important to know the version of the tool you are using.
* [ ] Show version as part of output.

Performance and optimization
* [ ] Parallel validation of really-really large files (1GB+ ?). I know you have them and not so much memory.
Expand All @@ -545,6 +527,7 @@ Mock data generation
Reporting
* [ ] More report formats (like JSON, XML, etc). Any ideas?
* [ ] Gitlab and JUnit reports must be as one structure. It's not so easy to implement. But it's a good idea.
* [ ] Merge reports from multiple CSV files into one report. It's useful when you have a lot of files and you want to see all errors in one place. Especially for GitLab and JUnit reports.

Misc
* [ ] Use it as PHP SDK. Examples in Readme.
Expand Down

0 comments on commit 4defc44

Please sign in to comment.