Skip to content

Commit

Permalink
Merge branch 'release/v0.2.4' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
betterthanclay committed Sep 26, 2023
2 parents f486bce + 5b7d6b8 commit 1a0cd0f
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 127 deletions.
133 changes: 47 additions & 86 deletions .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,104 +8,76 @@ on:
- "develop"
pull_request: null

jobs:
byte_level:
name: "0️⃣ Byte-level"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout code"
uses: "actions/checkout@v3"

- name: "Check file permissions"
run: |
test "$(find . -type f -not -path './.git/*' -executable)" = ""
env:
PHP_EXTENSIONS: "intl"

- name: "Find non-printable ASCII characters"
run: |
! LC_ALL=C.UTF-8 find . -type f -name "*.php" -print0 | xargs -0 -- grep -PHn "[^ -~]" | grep -v '// @ignore-non-ascii$'
syntax_errors:
name: "1️⃣ Syntax errors"
jobs:
file_consistency:
name: "1️⃣ File consistency"
runs-on: "ubuntu-latest"
steps:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.0"
extensions: "intl"
extensions: "${{ env.PHP_EXTENSIONS }}"
ini-values: "post_max_size=256M"

- name: "Checkout code"
uses: "actions/checkout@v3"

- name: Install Effigy
run: |
composer global config --no-plugins allow-plugins.phpstan/extension-installer true
composer global require decodelabs/effigy
- name: "Install dependencies"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "highest"

- name: "Check file permissions"
run: |
composer global exec effigy check-executable-permissions
- name: "Check exported files"
run: |
composer global exec effigy check-git-exports
- name: "Find non-printable ASCII characters"
run: |
composer global exec effigy check-non-ascii
- name: "Check source code for syntax errors"
run: "composer exec -- parallel-lint src/ ecs.php"
# @TODO Check template files for syntax errors
run: |
composer global exec effigy lint
unit_tests:
name: "2️⃣ Unit and functional tests"
static_analysis:
name: "3️⃣ Static Analysis"
needs:
- "byte_level"
- "syntax_errors"
- "file_consistency"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "8.0"
- "8.1"
dependencies:
- "lowest"
- "highest"
runs-on: "ubuntu-latest"
- "8.2"
steps:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "intl"
extensions: "${{ env.PHP_EXTENSIONS }}"
ini-values: "post_max_size=256M"

- name: "Checkout code"
uses: "actions/checkout@v3"

- name: "Install dependencies"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Execute unit tests"
# run: "composer run-script --no-interaction phpunit -- --verbose"
run: "echo 'Tom has the key.'"
# @TODO Functional tests

# - name: Send coverage to Coveralls
# if: "matrix.php-version == '8.1' && matrix.dependencies == 'highest'"
# env:
# COVERALLS_REPO_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
# run: |
# wget "https://github.com/php-coveralls/php-coveralls/releases/download/v2.5.2/php-coveralls.phar"
# php ./php-coveralls.phar -v

static_analysis:
name: "3️⃣ Static Analysis"
needs:
- "byte_level"
- "syntax_errors"
runs-on: "ubuntu-latest"
steps:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.0"
extensions: "intl"
ini-values: "post_max_size=256M"

- name: "Checkout code"
uses: "actions/checkout@v3"
- name: Install Effigy
run: |
composer global config --no-plugins allow-plugins.phpstan/extension-installer true
composer global require decodelabs/effigy
- name: "Validate Composer configuration"
run: "composer validate --strict"
Expand All @@ -116,21 +88,21 @@ jobs:
dependency-versions: "highest"

- name: "Execute static analysis"
run: "composer run-script --no-interaction analyze"
# @TODO Magic Number Detector, Copy-Paste Detector
run: |
composer global exec effigy analyze -- --headless
coding_standards:
name: "4️⃣ Coding Standards"
needs:
- "byte_level"
- "syntax_errors"
- "file_consistency"
runs-on: "ubuntu-latest"
steps:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.0"
extensions: "intl"
extensions: "${{ env.PHP_EXTENSIONS }}"
ini-values: "post_max_size=256M"

- name: "Checkout code"
Expand All @@ -142,28 +114,17 @@ jobs:
- name: "Check adherence to EditorConfig"
uses: "greut/eclint-action@v0"

- name: Install Effigy
run: |
composer global config --no-plugins allow-plugins.phpstan/extension-installer true
composer global require decodelabs/effigy
- name: "Install dependencies"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "highest"

- name: "Check coding style"
run: "composer run-script --no-interaction ecs"

exported_files:
name: "5️⃣ Exported files"
needs:
- "byte_level"
- "syntax_errors"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout code"
uses: "actions/checkout@v3"

- name: "Check exported files"
run: |
EXPECTED="LICENSE,README.md,composer.json"
CURRENT="$(git archive HEAD | tar --list --exclude="src" --exclude="src/*" | paste -s -d ",")"
echo "CURRENT =${CURRENT}"
echo "EXPECTED=${EXPECTED}"
test "${CURRENT}" = "${EXPECTED}"
composer global exec effigy format -- --headless
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v0.2.4 (2023-09-26)
* Migrated to use effigy in CI workflow
* Fixed PHP8.1 testing

## v0.2.3 (2022-09-27)
* Updated Veneer stub
* Updated composer check script
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
[![PHP from Packagist](https://img.shields.io/packagist/php-v/decodelabs/typify?style=flat)](https://packagist.org/packages/decodelabs/typify)
[![Latest Version](https://img.shields.io/packagist/v/decodelabs/typify.svg?style=flat)](https://packagist.org/packages/decodelabs/typify)
[![Total Downloads](https://img.shields.io/packagist/dt/decodelabs/typify.svg?style=flat)](https://packagist.org/packages/decodelabs/typify)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/decodelabs/typify/Integrate)](https://github.com/decodelabs/typify/actions/workflows/integrate.yml)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/decodelabs/typify/integrate.yml?branch=develop)](https://github.com/decodelabs/typify/actions/workflows/integrate.yml)
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-44CC11.svg?longCache=true&style=flat)](https://github.com/phpstan/phpstan)
[![License](https://img.shields.io/packagist/l/decodelabs/typify?style=flat)](https://packagist.org/packages/decodelabs/typify)

Mime type detection tools for PHP.
### Mime type detection tools for PHP

Use typify to identify and apply mime types information to your files and responses.

_Get news and updates on the [DecodeLabs blog](https://blog.decodelabs.com)._

---


## Installation
Expand Down
38 changes: 2 additions & 36 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,10 @@
"php": "^8.0",

"decodelabs/exceptional": "^0.4",
"decodelabs/veneer": "^0.10.7"
"decodelabs/veneer": "^0.10.10"
},
"require-dev": {
"phpunit/phpunit": "^9",
"phpstan/phpstan": "^1",
"phpstan/extension-installer": "^1.0",
"php-parallel-lint/php-parallel-lint": "^1.3",
"symplify/easy-coding-standard": "^11",

"decodelabs/phpstan-decodelabs": "^0.6",
"decodelabs/atlas": "^0.10.4",
"decodelabs/terminus": "^0.8.4"
"decodelabs/phpstan-decodelabs": "^0.6"
},
"autoload": {
"psr-4": {
Expand All @@ -37,31 +29,5 @@
"branch-alias": {
"dev-develop": "0.2.x-dev"
}
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
}
},
"scripts": {
"analyze": "phpstan analyze --no-progress",
"clear-phpstan": "phpstan clear-result-cache",
"ecs": "ecs check --no-progress-bar",
"ecs-fix": "ecs check --no-progress-bar --fix",
"lint": "parallel-lint src/ stubs/ ecs.php",
"eclint": "eclint check src/ stubs/ ecs.php",
"eclint-fix": "eclint fix src/ stubs/ ecs.php",
"non-ascii": "! LC_ALL=C.UTF-8 find src/ -type f -name \"*.php\" -print0 | xargs -0 -- grep -PHn \"[^ -~]\" | grep -v '// @ignore-non-ascii$'",
"veneer-stub": "vendor/bin/veneer-stub",
"check": [
"@composer update",
"@veneer-stub",
"@clear-phpstan",
"@analyze",
"@ecs-fix",
"@lint",
"@eclint",
"@non-ascii"
]
}
}
6 changes: 3 additions & 3 deletions stubs/DecodeLabs/Typify.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
*/
namespace DecodeLabs;

use DecodeLabs\Veneer\Proxy;
use DecodeLabs\Veneer\ProxyTrait;
use DecodeLabs\Veneer\Proxy as Proxy;
use DecodeLabs\Veneer\ProxyTrait as ProxyTrait;
use DecodeLabs\Typify\Detector as Inst;

class Typify implements Proxy
{
use ProxyTrait;

const VENEER = 'DecodeLabs\Typify';
const VENEER = 'DecodeLabs\\Typify';
const VENEER_TARGET = Inst::class;

public static Inst $instance;
Expand Down

0 comments on commit 1a0cd0f

Please sign in to comment.