Skip to content

Commit

Permalink
CI setup
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Dec 14, 2023
1 parent 24ca517 commit 739c482
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/php-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: PHP Linter

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

jobs:
php-linter:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false

steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
ref: ${{ github.event.client_payload.pull_request.head.ref }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none
tools: parallel-lint

- name: Lint PHP
run: composer exec --no-interaction -- parallel-lint bin/ lib/ tests/
44 changes: 44 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Static Analysis

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

jobs:
phpstan:
name: phpstan static code analysis
runs-on: ${{ matrix.os }}

strategy:
matrix:
include:
- os: ubuntu-latest
php-version: '8.0'
- os: ubuntu-latest
php-version: '8.1'
- os: ubuntu-latest
php-version: '8.2'
- os: ubuntu-latest
php-version: '8.3'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: gd, intl, pdo_mysql
coverage: none # disable xdebug, pcov

- name: Composer install
uses: ramsey/composer-install@v2
with:
composer-options: '--ansi --prefer-dist'

- name: Run phpstan analysis
run: vendor/bin/phpstan analyse --ansi
44 changes: 44 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Unit tests

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

jobs:
phpunit:
runs-on: ${{ matrix.os }}

strategy:
matrix:
include:
- os: ubuntu-latest
php-version: '8.0'
- os: ubuntu-latest
php-version: '8.1'
- os: ubuntu-latest
php-version: '8.2'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: gd, intl, pdo_mysql
coverage: none # disable xdebug, pcov

- name: Composer install
uses: ramsey/composer-install@v2
with:
composer-options: '--ansi --prefer-dist'

- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Run unit tests
run: vendor/bin/phpunit tests/ --colors=always

0 comments on commit 739c482

Please sign in to comment.