Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mnavarrocarter committed Jul 7, 2021
0 parents commit 221efbc
Show file tree
Hide file tree
Showing 17 changed files with 7,489 additions and 0 deletions.
131 changes: 131 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: "Code Integration Checks"

on:
pull_request:
push:
branches:
- "main"

env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --no-suggest --ignore-platform-req=php"

jobs:

# Checks for code style issues
cs-fixer:
name: "Style Checks by PHPCsFixer"
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
dependencies:
- "locked"
php-version:
- "7.4"
operating-system:
- "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2
- name: "Cache dependencies"
uses: "actions/cache@v2"
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update ${{ env.COMPOSER_FLAGS }}"
- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install ${{ env.COMPOSER_FLAGS }}"
- name: "Coding Standard"
run: "vendor/bin/php-cs-fixer fix --dry-run -v"

# This job statically analyses the code looking for errors
psalm:
name: "Static Analysis by Psalm"
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
dependencies:
- "locked"
php-version:
- "7.4"
operating-system:
- ubuntu-latest
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2
- name: "Cache Dependencies"
uses: "actions/cache@v2"
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update ${{ env.COMPOSER_FLAGS }}"
- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install ${{ env.COMPOSER_FLAGS }}"
- name: "psalm"
run: "vendor/bin/psalm --shepherd --stats"

# This job runs the test suite of the codebase
phpunit:
name: "Unit Tests by PHPUnit"
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
dependencies:
- "highest"
- "locked"
php-version:
- "7.4"
- "8.0"
operating-system:
- "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2
- name: "Cache dependencies"
uses: "actions/cache@v2"
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update ${{ env.COMPOSER_FLAGS }}"
- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install ${{ env.COMPOSER_FLAGS }}"
- name: "Tests"
run: "vendor/bin/phpunit"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vendor
cache
.php-cs-fixer.cache
27 changes: 27 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

$header = <<<EOF
@project Castor Mime
@link https://github.com/castor-labs/mime
@package castor/mime
@author Matias Navarro-Carter mnavarrocarter@gmail.com
@license MIT
@copyright 2021 CastorLabs Ltd
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF;

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PhpCsFixer' => true,
'declare_strict_types' => true,
'header_comment' => ['header' => $header, 'comment_type' => 'PHPDoc'],
])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
)
;
16 changes: 16 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Copyright 2021 CastorLabs Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions
of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
test:
XDEBUG_MODE=coverage vendor/bin/phpunit --testdox --coverage-text

lint:
vendor/bin/php-cs-fixer fix

type-check:
vendor/bin/psalm --stats --no-cache --show-info=true
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Castor Mime
===========

Mime type support for your application.

```
composer require castor/mime
```

38 changes: 38 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "castor/mime",
"description": "Mime Type support for your applications",
"minimum-stability": "stable",
"license": "MIT",
"keywords": ["php", "io", "golang", "php7"],
"authors": [
{
"name": "Matias Navarro Carter",
"email": "mnavarrocarter@gmail.com"
}
],
"config": {
"platform": {
"php": "7.4"
}
},
"require": {
"php": ">=7.4"
},
"autoload": {
"psr-4": {
"Castor\\Mime\\": "src"
},
"files": ["src/functions.php"]
},
"autoload-dev": {
"psr-4": {
"Castor\\Mime\\": "tests"
}
},
"require-dev": {
"roave/security-advisories": "dev-latest",
"friendsofphp/php-cs-fixer": "^3.0",
"phpunit/phpunit": "^9.5",
"vimeo/psalm": "^4.6"
}
}

0 comments on commit 221efbc

Please sign in to comment.