Skip to content

Commit

Permalink
Merge pull request #20 from TomHAnderson/feature/composer
Browse files Browse the repository at this point in the history
Feature/composer
  • Loading branch information
TomHAnderson authored Feb 28, 2024
2 parents 57dc73a + b0a9abd commit c7c14be
Show file tree
Hide file tree
Showing 5 changed files with 2,968 additions and 1,664 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Coding Standards"

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

jobs:
coding-standards:
name: "Coding Standards"
uses: "doctrine/.github/.github/workflows/[email protected]"
with:
php-version: '8.0'
composer-options: '--prefer-dist --ignore-platform-req=php'


85 changes: 85 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
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:
- "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"

37 changes: 37 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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

16 changes: 11 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
],
"require": {
"php": "^8.0",
"php": "~8.0.0 || ~8.1.0 || ~8.2.0",
"laminas-api-tools/api-tools-oauth2": "^1.9",
"doctrine/doctrine-orm-module": "^4.0 || ^5.0",
"laminas-api-tools/api-tools-mvc-auth": "^1.5.1",
Expand All @@ -27,16 +27,18 @@
},
"require-dev": {
"api-skeletons/coding-standard": "^1.0",
"phpunit/phpunit": "^9.5",
"laminas/laminas-authentication": "^2.7",
"laminas/laminas-eventmanager": "^3.2.1",
"laminas/laminas-form": "^3.0",
"laminas/laminas-loader": "^2.6.1",
"laminas/laminas-log": "^2.12",
"laminas/laminas-serializer": "^2.9.1",
"laminas/laminas-test": "^4.4",
"laminas/laminas-authentication": "^2.7",
"laminas/laminas-eventmanager": "^3.2.1",
"mockery/mockery": "^1.3.0",
"php-coveralls/php-coveralls": "^2.2"
"php-coveralls/php-coveralls": "^2.2",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpunit/phpunit": "^9.5",
"vimeo/psalm": "^5.22"
},
"autoload": {
"psr-4": {
Expand All @@ -60,5 +62,9 @@
},
"config": {
"sort-packages": true
},
"scripts": {
"test": "vendor/bin/parallel-lint ./src/ ./test && vendor/bin/phpcs && vendor/bin/phpunit ",
"coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-html=coverage"
}
}
Loading

0 comments on commit c7c14be

Please sign in to comment.