Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
inxilpro authored Jul 24, 2024
0 parents commit 7be2a48
Show file tree
Hide file tree
Showing 29 changed files with 1,238 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
exclude_patterns:
- ".github/"
- ".idea/"
- "stubs/"
- "tests/"
- "**/vendor/"
- "**/node_modules/"
- "*.md"
- ".*.yml"
- "LICENSE"
- "composer.json"
- "phpunit.xml"
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**What version does this affect?**
- Laravel Version: [e.g. 10.0.0]
- Package Version: [e.g. 1.5.0]

**To Reproduce**
Steps to reproduce the behavior:

**Expected behavior**
A clear and concise description of what you expected to happen.

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest a new feature idea or improvement
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
48 changes: 48 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Code Coverage

on:
push:
branches:
- main

jobs:
coverage:
runs-on: ubuntu-latest

name: Publish code coverage

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, pcntl, bcmath, intl, iconv
coverage: pcov

- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
vendor
${{ steps.composer-cache-files-dir.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
env:
COMPOSER_DISCARD_CHANGES: true
run: composer require --no-progress --no-interaction --prefer-dist --update-with-all-dependencies "laravel/framework:10.*" "orchestra/testbench:8.*"

- name: Run and publish code coverage
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageCommand: vendor/bin/phpunit --coverage-clover ${{ github.workspace }}/clover.xml
debug: true
coverageLocations:
"${{github.workspace}}/clover.xml:clover"
37 changes: 37 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Code Style

on: [ pull_request, push ]

jobs:
coverage:
runs-on: ubuntu-latest

name: Run code style checks

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: dom, curl, libxml, mbstring, zip, pcntl, bcmath, intl, iconv

- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
vendor
${{ steps.composer-cache-files-dir.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
env:
COMPOSER_DISCARD_CHANGES: true
run: composer require --no-progress --no-interaction --prefer-dist --update-with-all-dependencies "laravel/framework:10.*" "orchestra/testbench:8.*"

- name: Run PHP CS Fixer
run: ./vendor/bin/php-cs-fixer fix --diff --dry-run
63 changes: 63 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: PHPUnit

on:
push:
pull_request:
schedule:
- cron: '0 14 * * 3' # Run Wednesdays at 2pm EST

jobs:
php-tests:
runs-on: ubuntu-latest

strategy:
matrix:
php: [ 8.1, 8.2, 8.3 ]
laravel: [ 10.*, 11.* ]
dependency-version: [ stable, lowest ]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*
exclude:
- laravel: 11.*
php: 8.1

timeout-minutes: 10

name: "${{ matrix.php }} / ${{ matrix.laravel }} (${{ matrix.dependency-version }})"

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, bcmath, intl, iconv
tools: composer:v2

- name: Register composer cache directory
id: composer-cache-files-dir
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
vendor
${{ steps.composer-cache-files-dir.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: |
composer require --no-interaction --prefer-dist --no-update "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}"
composer update --no-interaction --prefer-dist --with-all-dependencies --prefer-${{ matrix.dependency-version }}
- name: Execute tests
run: vendor/bin/phpunit
47 changes: 47 additions & 0 deletions .github/workflows/template-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Template Cleanup
on:
push:
branches: [ main ]
jobs:
template-cleanup:
name: Template Cleanup
runs-on: ubuntu-latest
if: github.event.repository.name != 'laravel-package-template'
permissions:
contents: write
steps:
- name: Fetch Sources
uses: actions/checkout@v3
- name: Cleanup
run: |
export LC_CTYPE=C
export LANG=C
NAME="${GITHUB_REPOSITORY##*/}"
KEBAB=$(echo $NAME | tr -s -c '[:alpha:][:cntrl:]' ' ' | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
STUDLY="$(echo "$NAME" | awk '{split($0,a,"[_ -]"); for(i=1;i<=length(a);++i) printf "%s",(length(a[i]) > 0 ? toupper(substr(a[i],1,1)) tolower(substr(a[i],2)) : "")}')"
# Replace placeholder names
find . -type d \( -path "./.git" -o -path "./.github" \) -prune -o -type f -exec sed -i "s/laravel-package-template/$KEBAB/g" {} +
find . -type d \( -path "./.git" -o -path "./.github" \) -prune -o -type f -exec sed -i "s/LaravelPackageTemplate/$STUDLY/g" {} +
# Rename files
git mv .idea/laravel-package-template.iml .idea/$KEBAB.iml
git mv config/config.php config/$KEBAB.php
git mv src/Support/LaravelPackageTemplateServiceProvider.php src/Support/${STUDLY}ServiceProvider.php
# Cleanup
rm -f .github/workflows/template-cleanup.yml
- name: Show changes
run: git status
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Template cleanup"
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: main
github_token: ${{ secrets.GITHUB_TOKEN }}
27 changes: 27 additions & 0 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Update Changelog

on:
release:
types: [ published ]

jobs:
update-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.repository.full_name }}
ref: 'main'

- name: Update changelog
uses: thomaseizinger/keep-a-changelog-new-release@v1
with:
version: ${{ github.event.release.tag_name }}

- name: Commit changelog back to repo
uses: EndBug/add-and-commit@v8
with:
add: 'CHANGELOG.md'
message: ${{ github.event.release.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
vendor/
composer.phar
composer.lock
phpunit.xml
.phpunit.result.cache
.php_cs.cache
.php-cs-fixer.cache
.env

.DS_Store
.phpstorm.meta.php
_ide_helper.php

node_modules
mix-manifest.json
yarn-error.log
10 changes: 10 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7be2a48

Please sign in to comment.