Skip to content

Commit

Permalink
Refactor workflows to focus on demos
Browse files Browse the repository at this point in the history
Renamed workflow from "CI" to "Demo" to emphasize its focus on demonstrating features and use cases. Removed outdated or unused configuration options from the workflow file. Cleaned up commands and added a new command to run demo for GitHub. Updated README, composer.json, and other related files to reflect the changes being made to the workflow.
  • Loading branch information
Denis Smet committed Mar 10, 2024
1 parent 8daa1fe commit 94179dc
Show file tree
Hide file tree
Showing 14 changed files with 358 additions and 99 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#
# 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
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 }}
tools: composer

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

- name: 🧪 PHPUnit Tests
run: make demo-github
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,29 @@ update: ##@Project Install/Update all 3rd party dependencies
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 \
--output=github

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


demo: ##@Project Run all demo commands
@make demo-valid
@make demo-invalid
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ composer require jbzoo/csv-blueprint
```yml
# It's a full example of the CSV schema file in YAML format.

csv_structure: # Here are default values. You can skip this section if you don't need to override the default values
csv: # Here are default values. You can skip this section if you don't need to override the default values
header: true # If the first row is a header. If true, name of each column is required
delimiter: , # Delimiter character in CSV file
quote_char: \ # Quote character in CSV file
Expand All @@ -33,7 +33,7 @@ csv_structure: # Here are default values. You can skip this section if you don't
bom: false # If the file has a BOM (Byte Order Mark) at the beginning (Experimental)

columns:
- name: "csv_header_name" # Any custom name of the column in the CSV file (first row). Required if "csv_structure.header" is true.
- name: "csv_header_name" # Any custom name of the column in the CSV file (first row). Required if "csv.header" is true.
description: "Lorem ipsum" # Optional. Description of the column. Not used in the validation process.
rules:
# You can use the rules in any combination. Or not use any of them.
Expand Down Expand Up @@ -88,15 +88,15 @@ columns:

```json
{
"csv_structure" : {
"csv" : {
"header" : true,
"delimiter" : ",",
"quote_char" : "\\",
"enclosure" : "\"",
"encoding" : "utf-8",
"bom" : false
},
"columns" : [
"columns" : [
{
"name" : "csv_header_name",
"description" : "Lorem ipsum",
Expand Down Expand Up @@ -147,7 +147,7 @@ columns:
declare(strict_types=1);

return [
'csv_structure' => [
'csv' => [
'header' => true,
'delimiter' => ',',
'quote_char' => '\\',
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,18 @@
"require" : {
"php" : "^8.1",
"ext-mbstring" : "*",

"jbzoo/data" : "^7.1",
"jbzoo/cli" : "^7.1",
"jbzoo/utils" : "^7.1",
"league/csv" : "^9.15",
"fakerphp/faker" : "^1.23",
"jbzoo/utils" : "^7.1"
"jbzoo/ci-report-converter": "^7.2"
},

"require-dev" : {
"roave/security-advisories" : "dev-latest",
"jbzoo/toolbox-dev" : "^7.1",
"jbzoo/markdown": "^7.0"
"jbzoo/toolbox-dev" : "^7.1"
},

"autoload" : {
Expand Down
204 changes: 145 additions & 59 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 94179dc

Please sign in to comment.