Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bensherred authored Dec 11, 2023
0 parents commit 9b68019
Show file tree
Hide file tree
Showing 29 changed files with 750 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[{*.(yml, json)}]
indent_size = 2
16 changes: 16 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
* text=auto

/.github export-ignore
/art export-ignore
/docs export-ignore
/tests export-ignore
/scripts export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
phpstan.neon.dist export-ignore
phpunit.xml.dist export-ignore
CONTRIBUTING.md export-ignore
CHANGELOG.md export-ignore
CONTRIBUTING.md export-ignore
README.md export-ignore
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: 10.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
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE /config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Ask a question
url: https://github.com/red-explosion/package_slug/discussions/new?category=q-a
about: Ask the community for help
- name: Request a feature
url: https://github.com/red-explosion/package_slug/discussions/new?category=ideas
about: Share ideas for new features
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: fix
prefix-development: chore
include: scope
5 changes: 5 additions & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Always validate the PR title AND all the commits
titleAndCommits: true
# Allows use of Merge commits (e.g. on GitHub: "Merge branch 'main' into feature/ride-unicorns")
# this is only relevant when using commitsOnly: true (or titleAndCommits: true)
allowMergeCommits: true
42 changes: 42 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: coding standards

on:
push:
branches: [ main ]
pull_request:

permissions:
contents: read

jobs:
lint:
name: Coding Standards
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"

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

- name: Get composer cache directory path
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer
uses: actions/cache@v3
with:
path: ${{ steps.composercache.outputs.dir }}
key: dependencies-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: composer:v2
coverage: none

- name: Install dependencies
run: composer update --prefer-dist --no-interaction --no-progress

- name: Run Laravel Pint
run: ./vendor/bin/pint --config vendor/red-explosion/pint-config/pint.json --test
42 changes: 42 additions & 0 deletions .github/workflows/init.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: init package

on:
push:
branches: [ main ]

jobs:
init:
name: Init Package
runs-on: ubuntu-latest

# Only run this job when a repository has been created from the template, and it's an initial push (first commit)
if: github.repository != 'red-explosion/laravel-package-template' && github.run_number == 1 && github.event.base_ref == null

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

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

- name: Init
run: php init.php "$PACKAGE_NAME" "$PACKAGE_DESCRIPTION" "$AUTHOR_NAME" "$AUTHOR_USERNAME" "$AUTHOR_EMAIL"
env:
PACKAGE_NAME: ${{ github.event.repository.name }}
PACKAGE_DESCRIPTION: ${{ github.event.repository.description }}
AUTHOR_NAME: ${{ github.event.commits[0].author.name }}
AUTHOR_USERNAME: ${{ github.actor }}
AUTHOR_EMAIL: ${{ github.event.pusher.email }}

- name: Delete init files
run: |
rm .github/workflows/init.yml
rm init.php
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: initialise project"
42 changes: 42 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: static analysis

on:
push:
branches: [ main ]
pull_request:

permissions:
contents: read

jobs:
phpstan:
name: Static Analysis
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"

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

- name: Get composer cache directory path
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer
uses: actions/cache@v3
with:
path: ${{ steps.composercache.outputs.dir }}
key: dependencies-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: composer:v2
coverage: none

- name: Install dependencies
run: composer update --prefer-dist --no-interaction --no-progress

- name: Execute type checking
run: ./vendor/bin/phpstan analyse --error-format=github
50 changes: 50 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: tests

on:
push:
branches: [ main ]
pull_request:

permissions:
contents: write

jobs:
tests:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [ 8.2, 8.3 ]
laravel: [ 10.* ]

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

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

- name: Get composer cache directory path
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer
uses: actions/cache@v3
with:
path: ${{ steps.composercache.outputs.dir }}
key: dependencies-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: Install dependencies
run: |
composer require "illuminate/contracts:${{ matrix.laravel }}" --no-interaction --no-progress --no-update
composer update --prefer-dist --no-interaction --no-progress
- name: Execute the tests
run: ./vendor/bin/pest --compact
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:
changelog:
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
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# exclude OS files
.DS_Store

# exclude IDE files
/.fleet
/.idea
/.vscode

# exclude composer files
/vendor

# exclude local testing files
.phpunit.cache
phpunit.xml

# exclude because with package development it doesnt matter and reduces unnecessary merge conflicts
composer.lock

# exclude local static analysis files
phpstan.neon
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
Loading

0 comments on commit 9b68019

Please sign in to comment.