From 8f39d3eddd99b3a44a428ab8e0ce5d24d8995aad Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Fri, 3 Jan 2020 08:25:42 +0530 Subject: [PATCH] Add CakePHP example --- README.md | 1 + examples/cakephp.yml | 91 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 examples/cakephp.yml diff --git a/README.md b/README.md index c8fc4080..0d9a392b 100644 --- a/README.md +++ b/README.md @@ -255,6 +255,7 @@ Examples for setting up this GitHub Action with different PHP Frameworks/Package |Framework/Package|Runs on|Workflow| |--- |--- |--- | +|CakePHP|`macOS`, `ubuntu` and `windows`|[cakephp.yml](./examples/cakephp.yml "GitHub Action for CakePHP")| |CodeIgniter|`macOS`, `ubuntu` and `windows`|[codeigniter.yml](./examples/codeigniter.yml "GitHub Action for CodeIgniter")| |Laravel with `MySQL` and `Redis`|`ubuntu`|[laravel-mysql.yml](./examples/laravel-mysql.yml "GitHub Action for Laravel with MySQL and Redis")| |Laravel with `PostgreSQL` and `Redis`|`ubuntu`|[laravel-postgres.yml](./examples/laravel-postgres.yml "GitHub Action for Laravel with PostgreSQL and Redis")| diff --git a/examples/cakephp.yml b/examples/cakephp.yml new file mode 100644 index 00000000..ab818a47 --- /dev/null +++ b/examples/cakephp.yml @@ -0,0 +1,91 @@ +# GitHub Action for CakePHP +name: Testing CakePHP +on: [push, pull_request] +jobs: + tests: + strategy: + matrix: + operating-system: [ubuntu-latest, windows-latest, macOS-latest] + php-versions: ['7.2', '7.3', '7.4'] + runs-on: ${{ matrix.operating-system }} + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, intl, pdo_sqlite, pdo_mysql + coverage: pcov #optional + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Cache composer dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + # Use composer.json for key, if composer.lock is not committed. + # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: Install dependencies + run: | + composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader + composer run-script post-install-cmd --no-interaction + - name: Test with phpunit + run: vendor/bin/phpunit --coverage-text + + coding-standard: + name: Coding Standard + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v1 + with: + php-version: '7.3' + extensions: mbstring, intl + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Cache composer dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + # Use composer.json for key, if composer.lock is not committed. + # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: Install dependencies + run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader + - name: PHP CodeSniffer + run: composer cs-check + + static-analysis: + name: Static Analysis + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v1 + with: + php-version: '7.3' + extensions: mbstring, intl + tools: phpstan + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Cache composer dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + # Use composer.json for key, if composer.lock is not committed. + # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: Install dependencies + run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader + - name: Static Analysis using PHPStan + run: phpstan analyse --no-progress src/