Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Smet committed Mar 11, 2024
1 parent 0c40e6c commit 23c9447
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#
# 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'

jobs:
github-actions:
name: GitHub Actions
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: 👍 Valid CSV file
uses: jbzoo/csv-blueprint@master
with:
csv: files/demo.csv
schema: tests/schemas/demo_valid.yml

- name: 👎 Invalid CSV file - Report as GitHub Annotations
uses: jbzoo/csv-blueprint@master
with:
csv: files/demo.csv
schema: tests/schemas/demo_invalid.yml
continue-on-error: true

- name: 👎 Invalid CSV file - Report as Table
uses: jbzoo/csv-blueprint@master
with:
csv: files/demo.csv
schema: tests/schemas/demo_invalid.yml
output: table
continue-on-error: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# Csv-Blueprint-Demo
# JBZoo / Csv-Blueprint-Demo

[![CI](https://github.com/JBZoo/Csv-Blueprint/actions/workflows/demo.yml/badge.svg?branch=master)](https://github.com/JBZoo/Csv-Blueprint/actions/workflows/demo.yml?query=branch%3Amaster)

It's just a simple example of how to use the [Csv-Blueprint](https://github.com/JBZoo/Csv-Blueprint);

### See GitHub Actions for more details

* [.github/workflows/demo.yml](.github/workflows/demo.yml)
* [demo.csv](files/demo.csv)
* [demo_invalid.yml](files/demo_invalid.yml)
* [demo_valid.yml](files/demo_valid.yml)
11 changes: 11 additions & 0 deletions files/demo.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Name,City,Float,Birthday,Favorite color
Clyde,Rivsikgo,4825.1856,2000-01-01,green
Elsie,Vonavka,03.6544,2000-12-01,green
Derek,Sarefunaw,-177.9088,2000-01-31,green
Dylan,Wufolu,74605.944,1998-02-28,blue
Carl,Gorriju,0.8431,1955-05-14,red
Landon,Mojebol,123.64,1989-05-15,red
Olive,Pebiogu,0,1955-05-14,green
Willie,Sowaah,0.001,2010-07-20,red
Derrick,Rakufag,42,1990-09-10,green
Lois,Mofninle,-19366059127.6032,1988-08-24,green
42 changes: 42 additions & 0 deletions files/demo_invalid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# 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
#

columns:
- name: Name
rules:
not_empty: true
min_length: 5
max_length: 7

- name:
rules:
not_empty: true
only_capitalize: true

- name: Float
rules:
not_empty: true
is_float: true
min: -19366059128
max: 74605

- name: Birthday
rules:
not_empty: true
date_format: Y-m-d
min_date: "1955-05-15"
max_date: "2009-01-01"

- name: Favorite color
rules:
not_empty: true
allow_values: [ red, green, Blue ]
40 changes: 40 additions & 0 deletions files/demo_valid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#
# 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
#

columns:
- name: Name
rules:
not_empty: true
min_length: 4
max_length: 7

- name: City
rules:
not_empty: true
only_capitalize: true

- name: Float
rules:
not_empty: true
is_float: true
min: -19366059128
max: 74606

- name: Birthday
rules:
not_empty: true
date_format: Y-m-d

- name: Favorite color
rules:
not_empty: true
allow_values: [ red, green, blue ]

0 comments on commit 23c9447

Please sign in to comment.