PHPackages                             ghostwriter/compliance - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. ghostwriter/compliance

ActiveProject[Testing &amp; Quality](/categories/testing)

ghostwriter/compliance
======================

Compliance - CI/CD &amp; QA Test Automation for PHP via GitHub Actions.

v1.x-dev(1mo ago)01.3k[5 issues](https://github.com/ghostwriter/compliance/issues)BSD-3-ClausePHPPHP ~8.4.0 || ~8.5.0CI passing

Since Apr 8Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/ghostwriter/compliance)[ Packagist](https://packagist.org/packages/ghostwriter/compliance)[ Docs](https://github.com/ghostwriter/compliance)[ GitHub Sponsors](https://github.com/sponsors/ghostwriter)[ RSS](/packages/ghostwriter-compliance/feed)WikiDiscussions v1 Synced 1mo ago

READMEChangelogDependencies (18)Versions (6)Used By (0)

Compliance
==========

[](#compliance)

[![GitHub Sponsors](https://camo.githubusercontent.com/6b10885a76288cdc49c235b423f2727038a760785a4ffc210f70c89762fc66cd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73706f6e736f72732f67686f73747772697465723f6c6162656c3d53706f6e736f722b4067686f73747772697465722f636f6d706c69616e6365266c6f676f3d4769744875622b53706f6e736f7273)](https://github.com/sponsors/ghostwriter)[![Automation](https://github.com/ghostwriter/compliance/actions/workflows/automation.yml/badge.svg)](https://github.com/ghostwriter/compliance/actions/workflows/automation.yml)[![Supported PHP Version](https://camo.githubusercontent.com/0604b134afedcf67b991af67c1a855eea4ff14124c8f51d79163b281f398d2c4/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f7068702f67686f73747772697465722f636f6d706c69616e63653f636f6c6f723d383839326266)](https://www.php.net/supported-versions)[![Downloads](https://camo.githubusercontent.com/a7ee49cbc10564658a1c2138071632b26e088446fb3819d6d2e5ce225a1bee9c/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f64742f67686f73747772697465722f636f6d706c69616e63653f636f6c6f723d626c7565)](https://packagist.org/packages/ghostwriter/compliance)

`Automation` - `CI/CD` &amp; `QA Testing` Test Automation for `PHP` via `GitHub Actions`.

Caution

This project is not finished yet, work in progress.

Todo
----

[](#todo)

- check the composer scripts section to see if the commands exists,

    - and report error/warning if not
    - and skip the job if not
- all tools should have a matching composer script name, i have already hardcoded the composer script for now, but this should be configurable (kebab case)

    - the command will be `composer automation:composer-require-checker`
        - or `composer automation:phpunit`
            - I like the `automation:` prefix, that way if you have a `phpunit` script,
            - it will not cause a conflict with the `automation:phpunit` script
- I will import the release automation into this project
- we will import the `composer.json` and `composer.lock` validation into this project

    - we will use the extensions field from the `composer.json` file to determine which PHP extensions to install
    - pass the extensions list as an argument to the docker image/workflow via shivammathur/setup-php@v2 (looks like this part is already done, but we need to test it.)
    - i did most of this... but i need to test it.
    - we have everything we need to extract information from both composer files

> \[!INFO\]
>
> Woot woot!! we did it! we have a working prototype! 🎉

\-- we need to import gpg keys from GitHub secrets `GPG_KEY`,`GPG_FINGERPRINT`--- to tag the release with a gpg signature --- to sign binaries with a gpg signature --- to sign the git commit with a gpg signature (automated composer.json update, if all tests pass)

- we need to add a command to add these commannds to the users composer.json file, for each supported tools they have in their composer.json file \[`require` and `require-dev`\].
- if it does not exist, we will add it to the `scripts` section.
- if it exists, continue.

```
{
    "scripts": {
        "automation:composer-require-checker": [
            "composer-require-checker check --config-file=composer-require-checker.json"
        ],
        "automation:phpunit": [
              "@phpunit --configuration=phpunit.xml --coverage-clover=coverage.xml"
        ]
    }
}
```

Workflow
--------

[](#workflow)

```
# .github/workflows/automation.yml
name: Automation

on:
  pull_request:
  push:
    branches:
      - "main"
      - "[0-9]+.[0-9]+.x" # 1.2.x
      - "v[0-9]+" # v1
  schedule:
    - cron: "0 * * * *" # Runs hourly
  workflow_dispatch: # Manually Trigger workflow

jobs:
  automation:
    uses: ghostwriter/compliance/.github/workflows/automation.yml@v1
    secrets:
      CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
      GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
      INFECTION_DASHBOARD_API_KEY: ${{ secrets.INFECTION_DASHBOARD_API_KEY }}
```

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require ghostwriter/compliance --dev
```

```
Automation - Automatically configure and execute multiple CI/CD & QA Tests via GitHub Actions. 1.x-dev

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  help        Display help for a command
  list        List commands
  matrix      Generates a job matrix for Github Actions.
  workflow    Creates a "automation.yml" workflow file.
```

Usage
-----

[](#usage)

Generates `automation.php` configuration file, if it does not exist, and determines the job matrix for GitHub Actions.

```
vendor/bin/automation matrix
```

Generate `.github/workflows/automation.yml` workflow file for your project.

```
vendor/bin/automation workflow
```

Docker
------

[](#docker)

```
# Install from the command line:

docker pull ghcr.io/ghostwriter/compliance:v1

# Usage from the command line:

docker run -v $(PWD):/app -w=/app ghcr.io/ghostwriter/compliance workflow
docker run -v $(PWD):/app -w=/app ghcr.io/ghostwriter/compliance matrix

# Use as base image in Dockerfile:

FROM ghcr.io/ghostwriter/compliance:v1
```

Supported Tools ?!
------------------

[](#supported-tools-)

```
