test: adding phpunit tests #37
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
name: Test PHP | |
on: | |
pull_request: | |
types: [opened, synchronize, ready_for_review] | |
jobs: | |
phplint: | |
name: PHPLint | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name | |
steps: | |
- name: Setup PHP version | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
extensions: simplexml | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Setup Composer cache | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install composer | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: Run PHPCS | |
run: composer run lint | |
phpstan: | |
name: PHPStan | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name | |
steps: | |
- name: Setup PHP version | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
extensions: simplexml, mysql | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Setup Composer cache | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install composer | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: PHPStan Static Analysis | |
run: composer phpstan | |
phpunit: | |
name: PHPUnit | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name | |
steps: | |
- name: Setup PHP version | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
extensions: simplexml, mysql | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Setup Composer cache | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install Subversion | |
run: sudo apt-get update && sudo apt-get install -y subversion | |
- name: Install composer | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: Install npm | |
run: npm ci | |
- name: Run build | |
run: npm run build | |
- name: Setup environment | |
run: composer run-script setup | |
- name: PHPUnit tests | |
run: composer run-script phpunit |