Skip to content

Commit

Permalink
Upgrade to czim/laravel-paperclip 5
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel de Wit authored and daniel-de-wit committed Nov 18, 2022
1 parent ffeb89f commit 7c0d9d5
Show file tree
Hide file tree
Showing 22 changed files with 413 additions and 155 deletions.
18 changes: 9 additions & 9 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/.github export-ignore
/docker export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.coveralls.yml export-ignore
/.styleci.yml export-ignore
/lighthouse-paperclip-demo.gif export-ignore
/docker export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/docker-compose.yml export-ignore
/lighthouse-paperclip-demo.gif export-ignore
/Makefile export-ignore
/phpstan.neon export-ignore
/phpunit.xml.dist export-ignore
/rector.php export-ignore
26 changes: 26 additions & 0 deletions .github/workflows/run-composer-normalize.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Normalize

on:
push:
paths:
- composer.json

jobs:
normalize:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v2

- name: Validate Composer configuration
run: composer validate --strict

- name: Normalize composer.json
run: |
composer global config --no-plugins allow-plugins.ergebnis/composer-normalize true
composer global require ergebnis/composer-normalize
composer normalize
- uses: stefanzweifel/[email protected]
with:
commit_message: normalize composer.json
44 changes: 44 additions & 0 deletions .github/workflows/run-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Coverage

on: [push, pull_request]

jobs:
coverage:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1]
dependency-version: [prefer-stable]

name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: pcov

- name: Install dependencies
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction

- name: Execute tests with coverage
run: composer coverage

- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls
36 changes: 36 additions & 0 deletions .github/workflows/run-larastan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Static Analysis

on: [push, pull_request, workflow_dispatch]

jobs:
static-analysis:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1]
dependency-version: [prefer-stable]

name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}

- name: Install dependencies
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction

- name: Execute static code analysis
run: composer phpstan
38 changes: 38 additions & 0 deletions .github/workflows/run-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Code Style

on: [push, pull_request]

jobs:
fix-style:
name: Fix Code Style
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1]
dependency-version: [prefer-stable]
env:
COMPOSER_NO_INTERACTION: 1

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}

- name: Install dependencies
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction

- run: composer rector
continue-on-error: true

- run: composer pint
continue-on-error: true

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: composer pint
43 changes: 43 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Tests

on: [push, pull_request, workflow_dispatch]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1]
dependency-version: [prefer-lowest, prefer-stable]

name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip
coverage: none

- name: Setup Problem Matches
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction

- name: Execute tests
run: composer test
19 changes: 0 additions & 19 deletions .scrutinizer.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .styleci.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ setup:
@docker-compose run --rm app composer install

destroy:
@docker-compose down --rmakemove-orphans --volumes
@docker-compose down --remove-orphans --volumes

.PHONY: app
app:
@docker-compose run --rm app sh

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Build Status](https://img.shields.io/travis/daniel-de-wit/lighthouse-paperclip/master.svg?style=flat-square)](https://travis-ci.org/daniel-de-wit/lighthouse-paperclip)
[![Coverage Status](https://coveralls.io/repos/github/daniel-de-wit/lighthouse-paperclip/badge.svg?branch=master)](https://coveralls.io/github/daniel-de-wit/lighthouse-paperclip?branch=master)
[![Quality Score](https://img.shields.io/scrutinizer/g/daniel-de-wit/lighthouse-paperclip.svg?style=flat-square)](https://scrutinizer-ci.com/g/daniel-de-wit/lighthouse-paperclip)
[![Total Downloads](https://img.shields.io/packagist/dt/daniel-de-wit/lighthouse-paperclip.svg?style=flat-square)](https://packagist.org/packages/daniel-de-wit/lighthouse-paperclip)

This package will add two directives that will support working with [czim/laravel-paperclip](https://github.com/czim/laravel-paperclip).
Expand Down
33 changes: 22 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
{
"name": "daniel-de-wit/lighthouse-paperclip",
"description": "Lighthouse GraphQL Directives for Paperclip attachment support",
"license": "MIT",
"type": "library",
"keywords": [
"daniel-de-wit",
"laravel-paperclip",
"lighthouse",
"lighthouse-paperclip"
],
"homepage": "https://github.com/daniel-de-wit/lighthouse-paperclip",
"license": "MIT",
"type": "library",
"authors": [
{
"name": "Daniel de Wit",
"email": "[email protected]",
"role": "Developer"
}
],
"homepage": "https://github.com/daniel-de-wit/lighthouse-paperclip",
"require": {
"php": "^7.4|^8.0",
"czim/laravel-paperclip": "^3|^4",
"php": "^8.1",
"czim/laravel-paperclip": "^5",
"nuwave/lighthouse": "^5"
},
"require-dev": {
"orchestra/testbench": "^6.0",
"laravel/pint": "^1.2",
"nunomaduro/larastan": "^2.2",
"orchestra/testbench": "^7.11",
"php-coveralls/php-coveralls": "^2.4",
"phpunit/phpunit": "^9.0"
"phpstan/phpstan-mockery": "^1.1",
"phpstan/phpstan-phpunit": "^1.2",
"phpunit/phpunit": "^9.5",
"rector/rector": "^0.14.8"
},
"autoload": {
"psr-4": {
Expand All @@ -37,10 +42,6 @@
"DanielDeWit\\LighthousePaperclip\\Tests\\": "tests"
}
},
"scripts": {
"test": "vendor/bin/phpunit",
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
},
"config": {
"sort-packages": true
},
Expand All @@ -50,5 +51,15 @@
"DanielDeWit\\LighthousePaperclip\\Providers\\LighthousePaperclipServiceProvider"
]
}
},
"scripts": {
"post-autoload-dump": [
"@php ./vendor/bin/testbench package:discover --ansi"
],
"coverage": "vendor/bin/phpunit",
"phpstan": "vendor/bin/phpstan analyse",
"pint": "vendor/bin/pint",
"rector": "vendor/bin/rector",
"test": "vendor/bin/phpunit --no-coverage"
}
}
10 changes: 9 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@ FROM php:8.1-cli-alpine

WORKDIR /var/www/html

COPY conf.d /usr/local/etc/php/conf.d
COPY --from=composer /usr/bin/composer /usr/bin/composer

RUN apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
&& pecl install \
pcov \
&& docker-php-ext-enable \
pcov

COPY conf.d /usr/local/etc/php/conf.d
13 changes: 13 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
includes:
- vendor/nunomaduro/larastan/extension.neon
- vendor/phpstan/phpstan-mockery/extension.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon

parameters:
level: max
paths:
- src
- tests
stubFiles:
- vendor/nuwave/lighthouse/_ide_helper.php
Loading

0 comments on commit 7c0d9d5

Please sign in to comment.