Skip to content

Commit

Permalink
Merge pull request #5 from toneflix/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
3m1n3nc3 authored Jul 3, 2024
2 parents 10e2b83 + e28738c commit 4af40aa
Show file tree
Hide file tree
Showing 24 changed files with 466 additions and 161 deletions.
Binary file modified .DS_Store
Binary file not shown.
66 changes: 66 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Bug Report
description: Report an Issue or Bug with the Package
title: '[Bug]: '
labels: ['bug']
body:
- type: markdown
attributes:
value: |
We're sorry to hear you have a problem. Can you help us solve it by providing the following details.
- type: textarea
id: what-happened
attributes:
label: What happened?
description: What did you expect to happen?
placeholder: I cannot currently do X thing because when I do, it breaks X thing.
validations:
required: true
- type: textarea
id: how-to-reproduce
attributes:
label: How to reproduce the bug
description: How did this occur, please add any config values used and provide a set of reliable steps if possible.
placeholder: When I do X I see Y.
validations:
required: true
- type: input
id: package-version
attributes:
label: Package Version
description: What version of our Package are you running? Please be as specific as possible
placeholder: 1.0.0
validations:
required: true
- type: input
id: php-version
attributes:
label: PHP Version
description: What version of PHP are you running? Please be as specific as possible
placeholder: 8.2.0
validations:
required: true
- type: input
id: laravel-version
attributes:
label: Laravel Version
description: What version of Laravel are you running? Please be as specific as possible
placeholder: 9.0.0
validations:
required: true
- type: dropdown
id: operating-systems
attributes:
label: Which operating systems does with happen with?
description: You may select more than one.
multiple: true
options:
- macOS
- Windows
- Linux
- type: textarea
id: notes
attributes:
label: Notes
description: Use this field to provide any other notes that you feel might be relevant to the issue.
validations:
required: false
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: Ask a question
url: https://github.com/toneflix/laravel-fileable/issues/new?assignees=&labels=question
about: Ask the community for help
- name: Request a feature
url: https://github.com/toneflix/laravel-fileable/issues/new?assignees=&labels=feature
about: Share ideas for new features
- name: Report a security issue
url: https://github.com/toneflix/laravel-fileable/security/policy
about: Learn how to notify us for sensitive bugs
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
20 changes: 20 additions & 0 deletions .github/workflows/check_imports.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Check Imports

on:
push:
branches: ['main', 'dev']
pull_request:
branches: ['main', 'dev']

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Check Imports
run: ./vendor/bin/check_imports
32 changes: 32 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: dependabot-auto-merge
on: pull_request_target

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:

- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2.1.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Auto-merge Dependabot PRs for semver-minor updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Auto-merge Dependabot PRs for semver-patch updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
27 changes: 27 additions & 0 deletions .github/workflows/fix-php-code-style-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Fix PHP code style issues

on:
push:
paths:
- '**.php'

permissions:
contents: write

jobs:
php-code-styling:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Fix PHP code style issues
uses: aglipanci/laravel-pint-action@2.4

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Fix styling
26 changes: 26 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: PHPStan

on:
push:
paths:
- "**.php"
- "phpstan.neon.dist"

jobs:
phpstan:
name: phpstan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
coverage: none

- name: Install composer dependencies
uses: ramsey/composer-install@v3

- name: Run PHPStan
run: ./vendor/bin/phpstan analyse --error-format=github ./src
75 changes: 52 additions & 23 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,65 @@
name: Run Composer Tests
name: Running Composer Tests

on:
push:
branches: [ "main", "dev" ]
branches: ['main', 'dev']
pull_request:
branches: [ "main" ]

permissions:
contents: read
branches: ['main', 'dev']

jobs:
build:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.1, 8.2, 8.3]
laravel: [9.*, 10.*, 11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
php: 8.1
- laravel: 11.*
testbench: 9.*
php: 8.2

runs-on: ubuntu-latest
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: xdebug

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install Matrix dependencies
if: ${{ matrix.testbench }}
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update --dev
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: List Installed Dependencies
run: composer show -D

- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Execute tests
run: ./vendor/bin/pest --coverage --ci
env:
XDEBUG_MODE: coverage

- name: Run test suite
run: composer run-script test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.5.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/logs/clover.xml
31 changes: 31 additions & 0 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "Update Changelog"

on:
release:
types: [released]

permissions:
contents: write

jobs:
update:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main

- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}

- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: main
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Laravel Fileable

[![Test & Lint](https://github.com/toneflix/laravel-fileable/actions/workflows/php.yml/badge.svg?branch=dev)](https://github.com/toneflix/laravel-fileable/actions/workflows/php.yml)
[![Test & Lint](https://github.com/toneflix/laravel-fileable/actions/workflows/run-tests.yml/badge.svg?branch=dev)](https://github.com/toneflix/laravel-fileable/actions/workflows/run-tests.yml)
[![Latest Stable Version](http://poser.pugx.org/toneflix-code/laravel-fileable/v)](https://packagist.org/packages/toneflix-code/laravel-fileable) [![Total Downloads](http://poser.pugx.org/toneflix-code/laravel-fileable/downloads)](https://packagist.org/packages/toneflix-code/laravel-fileable) [![Latest Unstable Version](http://poser.pugx.org/toneflix-code/laravel-fileable/v/unstable)](https://packagist.org/packages/toneflix-code/laravel-fileable) [![License](http://poser.pugx.org/toneflix-code/laravel-fileable/license)](https://packagist.org/packages/toneflix-code/laravel-fileable) [![PHP Version Require](http://poser.pugx.org/toneflix-code/laravel-fileable/require/php)](https://packagist.org/packages/toneflix-code/laravel-fileable)
[![codecov](https://codecov.io/gh/toneflix/laravel-fileable/graph/badge.svg?token=2O7aFulQ9P)](https://codecov.io/gh/toneflix/laravel-fileable)

Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
],
"require": {
"php": "^8.1|^8.2|^8.3",
"illuminate/filesystem": "^8.1|^9.0|^10.0|^11.0",
"illuminate/support": "^8.1|^9.0|^10.0|^11.0",
"illuminate/filesystem": "^9.0|^10.0|^11.0",
"illuminate/support": "^9.0|^10.0|^11.0",
"imanghafoori/php-imports-analyzer": "^1.0",
"intervention/image": "^3.5"
},
"require-dev": {
"pestphp/pest": "2.x-dev",
"pestphp/pest": "^2.34",
"laravel/pint": "^1.15",
"fakerphp/faker": "^1.23",
"illuminate/contracts": "^9.0|^10.0|^11.0",
Expand Down
18 changes: 14 additions & 4 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Test Suite">
Expand All @@ -15,4 +15,14 @@
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
<php>
<server name="APP_ENV" value="testing" />
<server name="BCRYPT_ROUNDS" value="4" />
<server name="CACHE_DRIVER" value="array" />
<server name="DB_CONNECTION" value="sqlite" />
<server name="DB_DATABASE" value=":memory:" />
<server name="MAIL_DRIVER" value="array" />
<server name="QUEUE_CONNECTION" value="sync" />
<server name="SESSION_DRIVER" value="array" />
</php>
</phpunit>
Binary file modified src/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Facades/Fileable.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

/**
* @see \ToneflixCode\LaravelFileable\Media
*
*
* @method ?string getMedia(string $type, string $src = null, $returnPath = false, $legacyMode = false) Fetch an file from the storage
* @method bool exists(string $type, string $src = null) Check if the file exists
* @method ?string getPath(string $type, string $src = null) Get the relative path of the file
Expand Down
4 changes: 1 addition & 3 deletions src/Facades/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@
/**
* @see \ToneflixCode\LaravelFileable\Media
*/
class Media extends Fileable
{
}
class Media extends Fileable {}
Loading

0 comments on commit 4af40aa

Please sign in to comment.