Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/actions #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Coding Standards"

on:
pull_request:
branches:
- "*.x"
- "main"
push:
branches:
- "*.x"
- "main"

jobs:
coding-standards:
name: "Coding Standards"
uses: "doctrine/.github/.github/workflows/coding-standards.yml@1.3.0"
with:
php-version: '7.2'
composer-options: '--prefer-dist --ignore-platform-req=php'

88 changes: 88 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: "Continuous Integration"

on:
pull_request:
branches:
- "*.x"
- "main"
push:
branches:
- "*.x"
- "main"

jobs:
phpunit:
name: "PHPUnit"
runs-on: "ubuntu-20.04"

strategy:
fail-fast: false
matrix:
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.0"
- "8.1"
- "8.2"
dependencies:
- "highest"
- "lowest"
optional-dependencies:
- true
- false

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
ini-values: "zend.assertions=1"
extensions: "pdo_mysql"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "${{ matrix.dependencies }}"
composer-options: "--prefer-dist"

- name: "Show Composer packages"
run: "composer show"

- name: "Run PHPUnit"
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"

- name: "Upload coverage file"
uses: "actions/upload-artifact@v2"
with:
name: "phpunit-${{ matrix.php-version }}-${{ matrix.dependencies }}-${{ matrix.dbal-version }}.coverage"
path: "coverage.xml"

upload_coverage:
name: "Upload coverage to Codecov"
runs-on: "ubuntu-20.04"
needs:
- "phpunit"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2

- name: "Download coverage files"
uses: "actions/download-artifact@v2"
with:
path: "reports"

- name: "Upload to Codecov"
uses: "codecov/codecov-action@v2"
with:
directory: "reports"
36 changes: 36 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: PHP Composer

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-

- name: Install dependencies
run: composer install --prefer-dist --no-progress

# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md

# - name: Run test suite
# run: composer run-script test
26 changes: 26 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Static analysis"

on:
pull_request:
branches:
- "*.x"
- "main"
push:
branches:
- "*.x"
- "main"

jobs:
psalm:
name: "Static Analysis"
runs-on: ubuntu-latest

steps:
- uses: shivammathur/setup-php@v2
with:
php-version: '7.2'
- uses: actions/checkout@v2
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: vendor/bin/psalm
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*.DS_Store
.idea
vendor

test/build
composer.lock
15 changes: 11 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"prefer-stable": true,
"require": {
"php": "^7.2.0 || ~8.0",
"php": "^7.4.0 || ^8.0",
"doctrine/data-fixtures": "^1.3.0",
"doctrine/doctrine-module": "^2.1 || ^4.0 || ^5.0",
"laminas/laminas-modulemanager": "^2.7.2 || ^3.0.0",
Expand Down Expand Up @@ -53,9 +53,16 @@
"@phpstan"
],
"lint": "lint src/",
"phpcs": "phpcs",
"phpstan": "phpstan analyze -c phpstan.neon --level=7 src/",
"test": "phpunit --colors=always",
"test": [
"phpcs",
"phpstan analyze -c phpstan.neon --level=5 src/",
"phpunit --colors=always"
],
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
},
"config": {
"allow-plugins": {
"laminas/laminas-dependency-plugin": true
}
}
}
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ includes:
- vendor/phpstan/phpstan-doctrine/extension.neon

parameters:
level: 5
fileExtensions:
- php
paths:
- src
treatPhpDocTypesAsCertain: false