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

Add (or update) GitHub Actions (GHA) files and related config. #13

Merged
merged 2 commits into from
Mar 24, 2025
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
6 changes: 6 additions & 0 deletions .config/.remarkrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"plugins": [
"remark-preset-lint-recommended",
["remark-lint-list-item-indent", "space"]
]
}
14 changes: 14 additions & 0 deletions .config/.yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
extends: default

ignore: |
vendor/

rules:
brackets:
max-spaces-inside: 1
document-start: disable
line-length:
level: warning
max: 120
truthy: {allowed-values: ["true", "false", "on"]}
14 changes: 7 additions & 7 deletions phpunit.xml.dist → .config/phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../vendor/phpunit/phpunit/phpunit.xsd"

beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
bootstrap="vendor/autoload.php"
cacheResultFile=".phpunit.cache/test-results"
bootstrap="../vendor/autoload.php"
cacheResultFile="../.phpunit.cache/test-results"
convertDeprecationsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
Expand All @@ -16,18 +16,18 @@
>
<testsuites>
<testsuite name="all">
<directory suffix=".php">tests/</directory>
<directory suffix=".php">../tests/</directory>
</testsuite>
</testsuites>

<coverage processUncoveredFiles="false">
<coverage cacheDirectory="../.phpunit.cache/code-coverage" processUncoveredFiles="false">
<include>
<directory suffix=".php">src/</directory>
<directory suffix=".php">../src/</directory>
</include>
<report>
<!-- clover outputFile="build/clover.xml"/ -->
<!-- html outputDirectory="build/coverage"/ -->
<text outputFile="php://stdout"/>
</report>
</coverage>
</phpunit>
</phpunit>
46 changes: 46 additions & 0 deletions .github/workflows/json.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: JSON Quality Assistance

on:
# This event occurs when there is activity on a pull request. The workflow
# will be run against the commits, after merge to the target branch (main).
pull_request:
branches: [ main ]
paths:
- '**.json'
- '.github/workflows/json.yml'
types: [ opened, reopened, synchronize ]
# This event occurs when there is a push to the repository.
push:
paths:
- '**.json'
- '.github/workflows/json.yml'
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
# Needed to allow the "concurrency" section to cancel a workflow run.
actions: write

jobs:
# 01.preflight.json.lint-syntax.yml
lint-json-syntax:
name: JSON Syntax Linting
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: docker://pipelinecomponents/jsonlint
with:
args: >-
find .
-not -path '*/.git/*'
-not -path '*/node_modules/*'
-not -path '*/vendor/*'
-name '*.json'
-type f
-exec jsonlint --quiet {} ;
21 changes: 0 additions & 21 deletions .github/workflows/linting-php.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/markdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: Markdown Quality Assistance

on:
# This event occurs when there is activity on a pull request. The workflow
# will be run against the commits, after merge to the target branch (main).
pull_request:
branches: [ main ]
paths:
- '**.md'
- '.github/workflows/markdown.yml'
types: [ opened, reopened, synchronize ]
# This event occurs when there is a push to the repository.
push:
paths:
- '**.md'
- '.github/workflows/markdown.yml'
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
# Needed to allow the "concurrency" section to cancel a workflow run.
actions: write

jobs:
# 01.quality.markdown.lint-syntax.yml
lint-markdown-syntax:
name: Markdown Linting
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: docker://pipelinecomponents/remark-lint
with:
args: >-
remark
--rc-path=.config/.remarkrc
--ignore-pattern='*/vendor/*'
31 changes: 0 additions & 31 deletions .github/workflows/php-version-sniff.yml

This file was deleted.

136 changes: 136 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
---
name: PHP Quality Assistance

on:
# This event occurs when there is activity on a pull request. The workflow
# will be run against the commits, after merge to the target branch (main).
pull_request:
paths:
- '**.php'
- '.config/phpcs.xml.dist'
- '.config/phpunit.xml.dist'
- '.github/workflows/php.yml'
- 'composer.json'
- 'composer.lock'
branches: [ main ]
types: [ opened, reopened, synchronize ]
# This event occurs when there is a push to the repository.
push:
paths:
- '**.php'
- '.config/phpcs.xml.dist'
- '.config/phpunit.xml.dist'
- '.github/workflows/php.yml'
- 'composer.json'
- 'composer.lock'
# Allow manually triggering the workflow.
workflow_dispatch:


# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
# Needed to allow the "concurrency" section to cancel a workflow run.
actions: write

jobs:
# 01.preflight.php.lint-syntax.yml
lint-php-syntax:
name: PHP Syntax Linting
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: docker://pipelinecomponents/php-linter
with:
args: >-
parallel-lint
--exclude .git
--exclude vendor
--no-progress
.
# 01.quality.php.validate.dependencies-file.yml
validate-dependencies-file:
name: Validate dependencies file
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: >-
composer validate
--check-lock
--no-plugins
--no-scripts
--strict
# 02.test.php.test-unit.yml
php-unittest:
name: PHP Unit Tests
needs:
- lint-php-syntax
- validate-dependencies-file
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php:
- '8.0' # from 2020-11 to 2022-11 (2023-11)
- '8.1' # from 2021-11 to 2023-11 (2025-12)
- '8.2' # from 2022-12 to 2024-12 (2026-12)
- '8.3' # from 2023-11 to 2025-12 (2027-12)
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
coverage: xdebug
ini-values: error_reporting=E_ALL, display_errors=On
php-version: ${{ matrix.php }}
- name: Install and Cache Composer dependencies
uses: "ramsey/composer-install@v2"
env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"}}'
- run: bin/phpunit --configuration .config/phpunit.xml.dist
# 03.quality.php.scan.dependencies-vulnerabilities.yml
scan-dependencies-vulnerabilities:
name: Scan Dependencies Vulnerabilities
needs:
- validate-dependencies-file
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install and Cache Composer dependencies
uses: "ramsey/composer-install@v2"
env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"}}'
- run: >-
composer audit
--abandoned=report
--no-dev
--no-plugins
--no-scripts
# 03.quality.php.lint-version-compatibility.yml
php-check-version-compatibility:
name: PHP Version Compatibility
needs:
- lint-php-syntax
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php:
- '8.0' # from 2020-11 to 2022-11 (2023-11)
- '8.1' # from 2021-11 to 2023-11 (2025-12)
- '8.2' # from 2022-12 to 2024-12 (2026-12)
- '8.3' # from 2023-11 to 2025-12 (2027-12)
steps:
- uses: actions/checkout@v4
- uses: docker://pipelinecomponents/php-codesniffer
with:
args: >-
phpcs
-s
--extensions=php
--ignore='*vendor/*'
--runtime-set testVersion ${{ matrix.php }}
--standard=PHPCompatibility
.
32 changes: 0 additions & 32 deletions .github/workflows/tests.yml

This file was deleted.

Loading
Loading