Skip to content
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
19 changes: 13 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
---
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: weekly
time: "04:00"
open-pull-requests-limit: 10
- package-ecosystem: composer
directory: "/"
schedule:
interval: weekly
time: "04:00"
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
time: "04:00"
open-pull-requests-limit: 5
19 changes: 0 additions & 19 deletions .github/stale.yml

This file was deleted.

68 changes: 33 additions & 35 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,59 @@
---
name: Run tests

on: [push]
on:
- push

jobs:
unit-tests:
strategy:
fail-fast: false
matrix:
php: [7.2, 7.3, 7.4]
dependency-version: [prefer-lowest, prefer-stable]
os: [ubuntu-latest]
test: [phpunit, phan, phpmd, phpcs, phpcbf, phpmnd, churn, phpstan, infection, psalm]
php:
- 8.3
- 8.4
- 8.5
dependency-version:
- prefer-lowest
- prefer-stable
os:
- ubuntu-latest
test:
- test-github

name: ${{ matrix.test }} on PHP${{ matrix.php }} with ${{ matrix.dependency-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v1
uses: actions/checkout@v7
- name: Setup PHP
uses: shivammathur/setup-php@v1
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, libxml, mbstring
tools: prestissimo
coverage: xdebug
- name: Composer self-update
run: |
composer self-update
extensions: dom, libxml
coverage: pcov
- name: Composer update
run: |
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
- name: Composer test-${{ matrix.test }}-${{ matrix.os }}
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Composer ${{ matrix.test }}-${{ matrix.os }}
run: |
composer test-${{ matrix.test }}-${{ matrix.os }}
composer ${{ matrix.test }}

coverage:
name: PHPUnit test coverage
security-audit:
# Audits the committed lock file, which is what Dependabot scans. Kept out of
# the matrix above because --prefer-lowest deliberately resolves to the oldest
# versions the constraints allow, which will always carry advisories.
name: Composer audit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
uses: actions/checkout@v7
- name: Setup PHP
uses: shivammathur/setup-php@v1
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.3
extensions: dom, libxml
tools: prestissimo, phpunit
coverage: xdebug
- name: Composer self-update
run: |
composer self-update
- name: Composer update
run: |
composer update --prefer-dist --no-interaction --no-suggest
- name: Get coverage
run: |
phpunit --coverage-clover=coverage.xml
- name: Send coverage report
coverage: none
- name: Audit composer.lock
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.xml
composer audit --locked
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
/clover.xml
/vendor/
/.idea/
/.php_cs.cache
/infection.log
/.phpunit.result.cache
/.phpunit.result.cache
/.phpunit.cache
/.phpcs.cache
.DS_Store
CLAUDE.md
13 changes: 11 additions & 2 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
pull_request_rules:
- name: automatic merge on new dependency
- name: automatic approval for Dependabot pull requests
conditions:
- author=dependabot[bot]
- status-success=continuous-integration/travis-ci/pr
actions:
review:
type: APPROVE
message: Automatically approving dependabot

- name: automatic merge on dependabot pull requests
conditions:
- author=dependabot[bot]
- check-success~=^test*
- check-success=Composer audit
actions:
merge:
method: merge
11 changes: 0 additions & 11 deletions .phan/config.php

This file was deleted.

55 changes: 55 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
COMPOSER ?= composer

.DEFAULT_GOAL := all

.PHONY: all
all: install test ## Install dependencies and run the full suite

.PHONY: install
install: ## Install dependencies
$(COMPOSER) install --no-interaction

.PHONY: update
update: ## Update dependencies and refresh the lock file
$(COMPOSER) update --no-interaction

.PHONY: test
test: ## Run every quality gate
$(COMPOSER) test

.PHONY: phpcs
phpcs: ## Check coding standard
$(COMPOSER) phpcs

.PHONY: phpcbf
phpcbf: ## Fix what the coding standard can fix automatically
$(COMPOSER) phpcbf

.PHONY: phpmd
phpmd: ## Check cyclomatic complexity
$(COMPOSER) phpmd

.PHONY: phpstan
phpstan: ## Run static analysis
$(COMPOSER) phpstan

.PHONY: phpunit
phpunit: ## Run the tests with coverage
$(COMPOSER) phpunit

.PHONY: audit
audit: ## Check the lock file for known advisories
$(COMPOSER) audit --locked

.PHONY: example
example: install ## Run the usage example
php example.php

.PHONY: clean
clean: ## Remove installed dependencies and build artifacts
rm -rf vendor .phpunit.cache .phpunit.result.cache .phpcs.cache clover.xml

.PHONY: help
help: ## List the available targets
@grep -hE '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-10s\033[0m %s\n", $$1, $$2}'
Loading