Skip to content

Commit

Permalink
New validation rules and refactoring (#23)
Browse files Browse the repository at this point in the history
This commit updates the GitHub Actions workflows by adding a new
"test-phar" job for verifying the functionality of the PHAR binary. The
names and actions of existing jobs were updated to be more informative.
The README file was also cleaned up for better readability. Changes also
included the addition of planned features related to tool versioning.
  • Loading branch information
SmetDenis committed Mar 14, 2024
1 parent 7f71221 commit 1baf221
Show file tree
Hide file tree
Showing 60 changed files with 1,118 additions and 549 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 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
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@

.PHONY: build

REPORT ?= table
COLUMNS_TEST ?= 150

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

REPORT ?= table

build: ##@Project Install all 3rd party dependencies
$(call title,"Install/Update all 3rd party dependencies")
Expand Down
Loading

0 comments on commit 1baf221

Please sign in to comment.