Add Dockerfile.zts
for PHP ZTS
#935
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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: CI | |
on: | |
pull_request: | |
branches: | |
- '*' | |
push: | |
branches: | |
- 'master' | |
schedule: | |
- cron: '0 0 * * *' | |
# To avoid copy-pasting the same commands and add control over the environment | |
env: | |
COLUMNS: 300 | |
BLUEPRINT: time ./csv-blueprint | |
BLUEPRINT_PHAR: time ./build/csv-blueprint.phar | |
BLUEPRINT_DOCKER: time docker run --rm --workdir=/parent-host -v .:/parent-host jbzoo/csv-blueprint:local | |
CMD_VALIDATE: validate:csv --ansi -vvv | |
VALID_TEST: --csv=./tests/fixtures/batch/*.csv --schema=./tests/schemas/demo_valid.yml | |
INVALID_TEST: --csv=./tests/fixtures/batch/*.csv --schema=./tests/schemas/demo_*.yml --schema=./tests/schemas/invalid_schema.yml | |
jobs: | |
test-current-versions: | |
name: Tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
ext-parallel: [ '', 'parallel' ] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
id: setup-php | |
with: | |
php-version: 8.3 | |
coverage: xdebug | |
extensions: ast, ${{ matrix.ext-parallel }} | |
env: | |
phpts: zts | |
- name: Build project | |
run: make build --no-print-directory | |
- name: 🧪 PHPUnit Tests | |
run: make test --no-print-directory | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
continue-on-error: true | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: 👍 Code Quality | |
run: make codestyle --no-print-directory | |
test-lowest-versions: | |
name: Tests - Lowest | |
runs-on: ubuntu-latest | |
env: | |
JBZOO_COMPOSER_UPDATE_FLAGS: '--prefer-lowest' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
coverage: none | |
extensions: ast | |
- name: Install project | |
run: make build --no-print-directory | |
## To see the difference between the current and the lowest versions | |
- name: Downgrade dependencies | |
run: make update --no-print-directory | |
- name: 🧪 PHPUnit Tests | |
run: make test --no-print-directory | |
- name: 👍 Code Quality | |
run: make codestyle --no-print-directory | |
test-latest-libs: | |
name: Tests - Latest | |
runs-on: ubuntu-latest | |
env: | |
JBZOO_COMPOSER_UPDATE_FLAGS: '--with-all-dependencies' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: highest | |
coverage: none | |
extensions: ast | |
- name: Install project | |
run: make build --no-print-directory | |
## To see the difference between the current and the latest versions | |
- name: Upgrade dependencies | |
run: make update --no-print-directory | |
- name: 🧪 PHPUnit Tests | |
run: make test --no-print-directory | |
- name: 👍 Code Quality | |
run: make codestyle --no-print-directory | |
verify-php-binary: | |
name: Verify PHP binary | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
- name: Build project in production mode | |
run: make build-prod --no-print-directory | |
- name: 🎨 Test help and logo | |
run: $BLUEPRINT --ansi -vvv | |
- name: 👍 Valid CSV files | |
run: $BLUEPRINT $CMD_VALIDATE $VALID_TEST | |
- name: 👎 Invalid CSV files | |
run: | | |
! $BLUEPRINT $CMD_VALIDATE $INVALID_TEST | |
verify-phar-binary: | |
name: Verify Phar | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-version: [ 8.2, 8.3 ] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
- name: Build project in production mode | |
run: make build-prod build-phar-file --no-print-directory | |
- name: 🎨 Test help and logo | |
run: $BLUEPRINT_PHAR --ansi -vvv | |
- name: 👍 Valid CSV files | |
run: $BLUEPRINT_PHAR $CMD_VALIDATE $VALID_TEST | |
- name: 👎 Invalid CSV files | |
run: | | |
! $BLUEPRINT_PHAR $CMD_VALIDATE $INVALID_TEST | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
continue-on-error: true | |
with: | |
name: PHAR - PHP v${{ matrix.php-version }} | |
path: ./build/csv-blueprint.phar | |
compression-level: 0 | |
verify-docker: | |
name: Verify Docker | |
runs-on: ubuntu-latest | |
env: | |
BENCH_COLS: 1 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
- name: Login to Docker Hub | |
uses: docker/#-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: 🐳 Building Docker Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: false | |
tags: jbzoo/csv-blueprint:local | |
- name: 🎨 Test help and logo | |
run: $BLUEPRINT_DOCKER --ansi -vvv | |
- name: 👍 Valid CSV files | |
run: $BLUEPRINT_DOCKER $CMD_VALIDATE $VALID_TEST | |
- name: 👎 Invalid CSV files | |
run: | | |
! $BLUEPRINT_DOCKER $CMD_VALIDATE $INVALID_TEST | |
- name: Prepare Benchmark | |
run: | | |
make build --no-print-directory | |
make bench-create-csv --no-print-directory | |
- name: 🔥 Benchmark | |
run: | | |
! make bench-docker-quick --no-print-directory | |
- name: Push Docker Image (master) | |
uses: docker/build-push-action@v5 | |
if: github.ref == 'refs/heads/master' | |
with: | |
context: . | |
push: true | |
tags: jbzoo/csv-blueprint:master | |
verify-docker-zts: | |
name: Verify Docker ZTS | |
runs-on: ubuntu-latest | |
env: | |
BENCH_COLS: 1 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
- name: Login to Docker Hub | |
uses: docker/#-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: 🐳 Building Docker Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile.zts | |
push: false | |
tags: jbzoo/csv-blueprint:local | |
- name: 🎨 Test help and logo | |
run: $BLUEPRINT_DOCKER --ansi -vvv | |
- name: 👍 Valid CSV files (Parallel) | |
run: $BLUEPRINT_DOCKER $CMD_VALIDATE $VALID_TEST --parallel | |
- name: 👎 Invalid CSV files (Parallel) | |
run: | | |
! $BLUEPRINT_DOCKER $CMD_VALIDATE $INVALID_TEST --parallel | |
- name: Prepare Benchmark | |
run: | | |
make build --no-print-directory | |
make bench-create-csv --no-print-directory | |
- name: 🔥 Benchmark (single thread) | |
run: | | |
! make bench-docker-quick --no-print-directory | |
- name: 🔥 Benchmark (multi threads) | |
run: | | |
! make bench-docker-quick-parallel --no-print-directory | |
- name: Push Docker Image (master-zts) | |
uses: docker/build-push-action@v5 | |
if: github.ref == 'refs/heads/master' | |
with: | |
context: . | |
file: Dockerfile.zts | |
push: true | |
tags: jbzoo/csv-blueprint:zts | |
verify-ga: | |
name: Verify GitHub Actions | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: 👍 Valid CSV files | |
uses: ./ | |
with: | |
csv: ./tests/fixtures/batch/*.csv | |
schema: ./tests/schemas/demo_valid.yml | |
- name: 👎 Invalid CSV files | |
uses: ./ | |
with: | |
csv: ./tests/fixtures/batch/*.csv | |
schema: ./tests/schemas/demo_*.yml | |
continue-on-error: true | |
reports: | |
name: Reports | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
coverage: xdebug | |
extensions: ast | |
- name: Install project | |
run: make build --no-print-directory | |
- name: 📝 Build Reports | |
run: make report-all --no-print-directory | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
continue-on-error: true | |
with: | |
name: Reports | |
path: build/ |