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

Update CI #104

Merged
merged 1 commit into from
Jan 19, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
coverage: none
extensions: mbstring
php-version: 8.1
php-version: 8.3

- run: composer install --no-interaction --no-progress --no-suggest

Expand All @@ -27,7 +27,7 @@ jobs:

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Apply php-cs-fixer changes
commit_message: Normalize composer.json

php-cs-fixer:
runs-on: ubuntu-latest
Expand All @@ -40,7 +40,7 @@ jobs:
with:
coverage: none
extensions: mbstring
php-version: 8.1
php-version: 8.3

- run: composer install --no-interaction --no-progress --no-suggest

Expand Down
102 changes: 32 additions & 70 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,38 @@ on:
branches:
- "master"

name: "Validate"

jobs:
composer-validate:
name: "Composer Validate"

runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
- uses: shivammathur/setup-php@v2
with:
coverage: none
extensions: mbstring
php-version: 8.1
php-version: 8.3

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

static-code-analysis:
name: "Static Code Analysis"

runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
- uses: shivammathur/setup-php@v2
with:
coverage: none
extensions: mbstring
php-version: 8.1
php-version: 8.3

- name: "Install locked dependencies with composer"
run: composer install --no-interaction --no-progress
- run: composer install --no-interaction --no-progress

- name: "Run phpstan/phpstan"
run: vendor/bin/phpstan analyse --configuration=phpstan.neon
- run: vendor/bin/phpstan analyse --configuration=phpstan.neon

tests:
name: "Tests"

runs-on: ubuntu-latest

strategy:
Expand All @@ -62,41 +47,34 @@ jobs:
- 7.4
- 8.0
- 8.1

- 8.2
- 8.3
dependencies:
- lowest
- locked
- highest

steps:
- name: "Checkout"
uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
- uses: shivammathur/setup-php@v2
with:
coverage: none
extensions: mbstring
php-version: ${{ matrix.php-version }}

- name: "Install lowest dependencies with composer"
if: matrix.dependencies == 'lowest'
- if: matrix.dependencies == 'lowest'
run: composer update --prefer-lowest --no-interaction --no-progress

- name: "Install locked dependencies with composer"
if: matrix.dependencies == 'locked'
- if: matrix.dependencies == 'locked'
run: composer install --no-interaction --no-progress

- name: "Install highest dependencies with composer"
if: matrix.dependencies == 'highest'
- if: matrix.dependencies == 'highest'
run: composer update --no-interaction --no-progress

- name: "Run unit tests with phpunit/phpunit"
run: vendor/bin/phpunit
- run: vendor/bin/phpunit

examples:
name: "Examples"

runs-on: ubuntu-latest

strategy:
Expand All @@ -111,64 +89,48 @@ jobs:
- polymorphic

steps:
- name: "Checkout"
uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
- uses: shivammathur/setup-php@v2
with:
coverage: none
extensions: mbstring
php-version: 8.1
php-version: 8.3
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Run the integration tests in each example"
run: cd examples/${{ matrix.example }} && ./test.sh
- run: cd examples/${{ matrix.example }} && ./test.sh

code-coverage:
name: "Code Coverage"

runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
- uses: shivammathur/setup-php@v2
with:
coverage: pcov
extensions: mbstring
php-version: 8.1
php-version: 8.3

- name: "Install locked dependencies with composer"
run: composer install --no-interaction --no-progress
- run: composer install --no-interaction --no-progress

- name: "Collect code coverage with Xdebug and phpunit/phpunit"
run: vendor/bin/phpunit --coverage-clover=build/logs/clover.xml
- run: vendor/bin/phpunit --coverage-clover=build/logs/clover.xml

- name: "Send code coverage report to codecov.io"
uses: codecov/codecov-action@v2
- uses: codecov/codecov-action@v2

mutation-tests:
name: "Mutation Tests"

runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
- uses: shivammathur/setup-php@v2
with:
coverage: xdebug
extensions: mbstring
php-version: 8.1
php-version: 8.3

- name: "Install locked dependencies with composer"
run: composer install --no-interaction --no-progress
- run: composer install --no-interaction --no-progress

- name: "Run mutation tests with infection/infection"
run: vendor/bin/infection
- run: vendor/bin/infection
Loading