diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 000000000..0c9057d14 --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,105 @@ +# This is a basic workflow to help you get started with Actions + +name: Linter On Push + +# Controls when the workflow will run +on: push + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "unit-tests" + linter: + # The type of runner that the job will run on + runs-on: ubuntu-latest + env: + APP_ENV: testing + APP_DEBUG: true + APP_KEY: base64:4vh0op/S1dAsXKQ2bbdCfWRyCI9r8NNIdPXyZWt9PX4= + DEV_EMAIL_TO: smarcet@gmail.com + APP_URL: http://localhost + DB_CONNECTION: model + DB_HOST: 127.0.0.1 + DB_PORT: 3306 + DB_DATABASE: api_config + DB_USERNAME: root + DB_PASSWORD: 1qaz2wsx + SS_DB_HOST: 127.0.0.1 + SS_DB_PORT: 3310 + SS_DATABASE: api_model + SS_DB_USERNAME: root + SS_DB_PASSWORD: 1qaz2wsx + REDIS_HOST: 127.0.0.1 + REDIS_PORT: 6379 + REDIS_DB: 0 + REDIS_PASSWORD: 1qaz2wsx + REDIS_DATABASES: 16 + SSL_ENABLED: false + SESSION_DRIVER: redis + PHP_VERSION: 8.3 + CACHE_DRIVER: redis + SESSION_COOKIE_DOMAIN: localhost + SESSION_COOKIE_SECURE: false + QUEUE_DRIVER: redis + REGISTRATION_DEFAULT_PAYMENT_PROVIDER: Stripe + REGISTRATION_DEFAULT_STRIPE_TEST_MODE: true + REGISTRATION_DEFAULT_LIVE_STRIPE_PRIVATE_KEY: + REGISTRATION_DEFAULT_LIVE_STRIPE_PUBLISHABLE_KEY: + REGISTRATION_DEFAULT_LIVE_WEBHOOK_SECRET: + REGISTRATION_DEFAULT_TEST_STRIPE_PRIVATE_KEY: sk_test_12345 + REGISTRATION_DEFAULT_TEST_STRIPE_PUBLISHABLE_KEY: pk_12345 + REGISTRATION_DEFAULT_TEST_WEBHOOK_SECRET: whsec_12345 + BOOKABLE_ROOMS_DEFAULT_PAYMENT_PROVIDER: Stripe + BOOKABLE_ROOMS_DEFAULT_STRIPE_TEST_MODE: true + BOOKABLE_ROOMS_DEFAULT_LIVE_STRIPE_PRIVATE_KEY: + BOOKABLE_ROOMS_DEFAULT_LIVE_STRIPE_PUBLISHABLE_KEY: + BOOKABLE_ROOMS_DEFAULT_LIVE_WEBHOOK_SECRET: + BOOKABLE_ROOMS_DEFAULT_TEST_STRIPE_PRIVATE_KEY: sk_test_12345 + BOOKABLE_ROOMS_DEFAULT_TEST_STRIPE_PUBLISHABLE_KEY: pk_12345 + BOOKABLE_ROOMS_DEFAULT_TEST_WEBHOOK_SECRET: whsec_12345 + REGISTRATION_VALIDATE_TICKET_TYPE_REMOVAL: false + services: + mysql_api_model: + image: mysql:8.0 + env: + MYSQL_ROOT_PASSWORD: ${{env.SS_DB_PASSWORD}} + MYSQL_DATABASE: ${{env.SS_DATABASE}} + ports: + - 3310:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10 --name=mysql_api_model + mysql_api_config: + image: mysql:8.0 + env: + MYSQL_ROOT_PASSWORD: ${{env.DB_PASSWORD}} + MYSQL_DATABASE: ${{env.DB_DATABASE}} + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10 + + steps: + - name: Create Redis + uses: supercharge/redis-github-action@1.7.0 + with: + redis-port: ${{env.REDIS_PORT}} + redis-password: ${{env.REDIS_PASSWORD}} + # Downloads a copy of the code in your repository before running CI tests + - name: Check out repository code + uses: actions/checkout@v4 + - name: Change MYSQL sql_mode + run: > + docker exec mysql_api_model mysql -u root --password=${{env.SS_DB_PASSWORD}} -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION';" + - name: Install PHP + uses: "shivammathur/setup-php@v2" + with: + php-version: ${{env.PHP_VERSION}} + extensions: pdo_mysql, mbstring, exif, pcntl, bcmath, sockets, gettext + - name: Install dependencies + uses: "ramsey/composer-install@v3" + env: + COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.COMPOSER_AUTH_TOKEN }}"} }' + - name: 'Run Tests' + run: | + ./update_doctrine.sh + php artisan db:create_test_db --schema=config + php artisan db:create_test_db --schema=model + php artisan doctrine:migrations:migrate --no-interaction --em model + vendor/bin/parallel-lint --blame --exclude .git --exclude vendor . diff --git a/.github/workflows/push.yml b/.github/workflows/unit_test.yml similarity index 100% rename from .github/workflows/push.yml rename to .github/workflows/unit_test.yml diff --git a/composer.json b/composer.json index 2af4b59eb..20dd264f6 100644 --- a/composer.json +++ b/composer.json @@ -52,12 +52,14 @@ "laminas/laminas-math": "^3.7" }, "require-dev": { - "filp/whoops": "^2.0", - "spatie/laravel-ignition": "^2.8.0", "fakerphp/faker": "^1.23", + "filp/whoops": "^2.0", + "laravel/browser-kit-testing": "7.2.0", "mockery/mockery": "^1.6", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.4", "phpunit/phpunit": "^11.0.1", - "laravel/browser-kit-testing": "7.2.0" + "spatie/laravel-ignition": "^2.8.0" }, "suggest":{ "lib-openssl": "Required to use AES algorithms (except AES GCM)", diff --git a/composer.lock b/composer.lock index a32a7bf0b..859148e1d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7a4c7e1f4f144f59ca7374a3de2cf834", + "content-hash": "66e2376f430daebe1798ffab76a67681", "packages": [ { "name": "affinipay/chargeio-php", @@ -10510,6 +10510,168 @@ }, "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "php-parallel-lint/php-console-color", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-parallel-lint/PHP-Console-Color.git", + "reference": "7adfefd530aa2d7570ba87100a99e2483a543b88" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-parallel-lint/PHP-Console-Color/zipball/7adfefd530aa2d7570ba87100a99e2483a543b88", + "reference": "7adfefd530aa2d7570ba87100a99e2483a543b88", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "replace": { + "jakub-onderka/php-console-color": "*" + }, + "require-dev": { + "php-parallel-lint/php-code-style": "^2.0", + "php-parallel-lint/php-parallel-lint": "^1.0", + "php-parallel-lint/php-var-dump-check": "0.*", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHP_Parallel_Lint\\PhpConsoleColor\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "jakub.onderka@gmail.com" + } + ], + "description": "Simple library for creating colored console ouput.", + "support": { + "issues": "https://github.com/php-parallel-lint/PHP-Console-Color/issues", + "source": "https://github.com/php-parallel-lint/PHP-Console-Color/tree/v1.0.1" + }, + "time": "2021-12-25T06:49:29+00:00" + }, + { + "name": "php-parallel-lint/php-console-highlighter", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-parallel-lint/PHP-Console-Highlighter.git", + "reference": "5b4803384d3303cf8e84141039ef56c8a123138d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-parallel-lint/PHP-Console-Highlighter/zipball/5b4803384d3303cf8e84141039ef56c8a123138d", + "reference": "5b4803384d3303cf8e84141039ef56c8a123138d", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.2", + "php-parallel-lint/php-console-color": "^1.0.1" + }, + "replace": { + "jakub-onderka/php-console-highlighter": "*" + }, + "require-dev": { + "php-parallel-lint/php-code-style": "^2.0", + "php-parallel-lint/php-parallel-lint": "^1.0", + "php-parallel-lint/php-var-dump-check": "0.*", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHP_Parallel_Lint\\PhpConsoleHighlighter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "acci@acci.cz", + "homepage": "http://www.acci.cz/" + } + ], + "description": "Highlight PHP code in terminal", + "support": { + "issues": "https://github.com/php-parallel-lint/PHP-Console-Highlighter/issues", + "source": "https://github.com/php-parallel-lint/PHP-Console-Highlighter/tree/v1.0.0" + }, + "time": "2022-02-18T08:23:19+00:00" + }, + { + "name": "php-parallel-lint/php-parallel-lint", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/php-parallel-lint/PHP-Parallel-Lint.git", + "reference": "6db563514f27e19595a19f45a4bf757b6401194e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-parallel-lint/PHP-Parallel-Lint/zipball/6db563514f27e19595a19f45a4bf757b6401194e", + "reference": "6db563514f27e19595a19f45a4bf757b6401194e", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=5.3.0" + }, + "replace": { + "grogy/php-parallel-lint": "*", + "jakub-onderka/php-parallel-lint": "*" + }, + "require-dev": { + "nette/tester": "^1.3 || ^2.0", + "php-parallel-lint/php-console-highlighter": "0.* || ^1.0", + "squizlabs/php_codesniffer": "^3.6" + }, + "suggest": { + "php-parallel-lint/php-console-highlighter": "Highlight syntax in code snippet" + }, + "bin": [ + "parallel-lint" + ], + "type": "library", + "autoload": { + "classmap": [ + "./src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "ahoj@jakubonderka.cz" + } + ], + "description": "This tool checks the syntax of PHP files about 20x faster than serial check.", + "homepage": "https://github.com/php-parallel-lint/PHP-Parallel-Lint", + "keywords": [ + "lint", + "static analysis" + ], + "support": { + "issues": "https://github.com/php-parallel-lint/PHP-Parallel-Lint/issues", + "source": "https://github.com/php-parallel-lint/PHP-Parallel-Lint/tree/v1.4.0" + }, + "time": "2024-03-27T12:14:49+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "11.0.3",