From 78ad61312e7652726d5795003102d564b8363181 Mon Sep 17 00:00:00 2001 From: Denis Smetannikov Date: Mon, 11 Mar 2024 17:02:06 +0400 Subject: [PATCH] GitHub Actions workflow to demo it (#7) --- .github/workflows/demo.yml | 94 +++++++++++++++++++--------- .github/workflows/main.yml | 22 +++++++ .github/workflows/release-docker.yml | 9 --- 3 files changed, 86 insertions(+), 39 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index c6764389..4f7b8d5b 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -67,8 +67,9 @@ jobs: run: OUTPUT=junit make demo-github --no-print-directory continue-on-error: true - php: - name: Pure PHP + + github-actions: + name: GitHub Actions runs-on: ubuntu-latest steps: - name: Checkout code @@ -76,30 +77,60 @@ jobs: with: fetch-depth: 0 - - name: Setup PHP - uses: shivammathur/setup-php@v2 + - name: 👍 Valid CSV file + uses: jbzoo/csv-blueprint@master with: - php-version: 8.3 - tools: composer + csv: tests/fixtures/demo.csv + schema: tests/schemas/demo_valid.yml - - name: Build the Project - run: make build-install --no-print-directory + - name: 👎 Invalid CSV file - Report as GitHub Annotations + uses: jbzoo/csv-blueprint@master + with: + csv: tests/fixtures/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: tests/fixtures/demo.csv + schema: tests/schemas/demo_invalid.yml + output: table + continue-on-error: true + + + docker: + name: Docker Hub + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Pull Docker Image + run: docker pull jbzoo/csv-blueprint - name: 👍 Valid CSV file run: | - ./csv-blueprint \ + docker run \ + -v `pwd`:/parent-host \ + --rm jbzoo/csv-blueprint \ validate:csv \ - --csv=./tests/fixtures/demo.csv \ - --schema=./tests/schemas/demo_valid.yml + --csv=/parent-host/tests/fixtures/demo.csv \ + --schema=/parent-host/tests/schemas/demo_valid.yml - name: 👎 Invalid CSV file run: | - ./csv-blueprint \ + docker run \ + -v `pwd`:/parent-host \ + --rm jbzoo/csv-blueprint \ validate:csv \ - --csv=./tests/fixtures/demo.csv \ - --schema=./tests/schemas/demo_invalid.yml + --csv=/parent-host/tests/fixtures/demo.csv \ + --schema=/parent-host/tests/schemas/demo_invalid.yml continue-on-error: true + phar: name: Phar runs-on: ubuntu-latest @@ -119,22 +150,23 @@ jobs: run: make build --no-print-directory - name: 👍 Valid CSV file - run: | + run: | ./build/csv-blueprint.phar \ validate:csv \ --csv=./tests/fixtures/demo.csv \ --schema=./tests/schemas/demo_valid.yml - name: 👎 Invalid CSV file - run: | + run: | ./build/csv-blueprint.phar \ validate:csv \ --csv=./tests/fixtures/demo.csv \ --schema=./tests/schemas/demo_invalid.yml continue-on-error: true - docker: - name: Docker Hub + + php: + name: Pure PHP runs-on: ubuntu-latest steps: - name: Checkout code @@ -142,24 +174,26 @@ jobs: with: fetch-depth: 0 - - name: Pull Docker Image - run: docker pull jbzoo/csv-blueprint + - 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: | - docker run \ - -v `pwd`:/parent-host \ - --rm jbzoo/csv-blueprint \ + ./csv-blueprint \ validate:csv \ - --csv=/parent-host/tests/fixtures/demo.csv \ - --schema=/parent-host/tests/schemas/demo_valid.yml + --csv=./tests/fixtures/demo.csv \ + --schema=./tests/schemas/demo_valid.yml - name: 👎 Invalid CSV file run: | - docker run \ - -v `pwd`:/parent-host \ - --rm jbzoo/csv-blueprint \ + ./csv-blueprint \ validate:csv \ - --csv=/parent-host/tests/fixtures/demo.csv \ - --schema=/parent-host/tests/schemas/demo_invalid.yml + --csv=./tests/fixtures/demo.csv \ + --schema=./tests/schemas/demo_invalid.yml continue-on-error: true diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 26fa8d94..31f5357c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -193,3 +193,25 @@ jobs: - name: Reporting example via Docker run: make demo-docker --no-print-directory continue-on-error: true + + github-action: + name: GitHub Action + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: 👍 Valid CSV file + uses: ./ + with: + csv: tests/fixtures/demo.csv + schema: tests/schemas/demo_valid.yml + + - name: 👎 Invalid CSV file + uses: ./ + with: + csv: tests/fixtures/demo.csv + schema: tests/schemas/demo_invalid.yml + continue-on-error: true diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 071f2609..3361cf16 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -18,21 +18,12 @@ on: push: branches: - 'master' - pull_request: - branches: - - "*" jobs: docker: name: Docker runs-on: ubuntu-latest steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: