Skip to content

Commit

Permalink
feat!: update template
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp committed May 30, 2023
1 parent 8777204 commit 9c83764
Show file tree
Hide file tree
Showing 22 changed files with 464 additions and 529 deletions.
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---

# this file is for the labeler workflow job
# Documentation https://github.com/marketplace/actions/labeler

Expand All @@ -10,3 +11,5 @@
'type: maintenance':
- .github/**/*
- tests/**/*

...
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---

# This workflow will triage pull requests and apply a label based on the
# paths that are modified in the pull request.
#
# To use this workflow, you will need to set up a .github/labeler.yml
# file with configuration. For more information, see:
# file with configuration. For more information, see:
# https://github.com/actions/labeler/blob/master/README.md

on: # yamllint disable-line rule:truthy
Expand All @@ -12,11 +14,10 @@ name: 🏷️ Add labels

jobs:
label:
runs-on: ubuntu-latest
steps:
- name: 🏷️ Apply labels
uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
uses: wayofdev/gh-actions/.github/workflows/apply-labels.yml@master
with:
os: ubuntu-latest
secrets:
token: ${{ secrets.GITHUB_TOKEN }}

...
19 changes: 9 additions & 10 deletions .github/workflows/auto-merge-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ name: 🤞 Auto merge release

jobs:
auto-merge:
if: github.actor == 'lotyp' && startsWith(github.head_ref, 'release-please--')
runs-on: ubuntu-latest
steps:
- name: 🤞 Auto-merge pull request
uses: peter-evans/enable-pull-request-automerge@v3
with:
pull-request-number: ${{ github.event.pull_request.number }}
merge-method: merge
# to trigger other workflows, pass PAT token instead of GITHUB_TOKEN
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
uses: wayofdev/gh-actions/.github/workflows/auto-merge-release.yml@master
with:
os: ubuntu-latest
pull-request-number: ${{ github.event.pull_request.number }}
actor: lotyp
merge-method: merge
secrets:
# to trigger other workflows, pass PAT token instead of GITHUB_TOKEN
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}

...
36 changes: 23 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---

on: # yamllint disable-line rule:truthy
push:
branches:
- master
pull_request:
branches:
- master
Expand All @@ -23,40 +20,53 @@ jobs:
- name: 📦 Check out the codebase
uses: actions/checkout@v3

- name: ️ Setup PHP
- name: 🛠️ Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, fileinfo
extensions: mbstring, fileinfo
ini-values: error_reporting=E_ALL
tools: composer:v2
coverage: none
tools: composer:v2, pecl
coverage: xdebug

- name: 🛠️ Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: ♻️ Load cached dependencies
- name: ♻️ Restore cached dependencies
id: cached-composer-dependencies
uses: actions/cache@v3
with:
path: vendor
key: vendor-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
key: vendor-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}-${{ matrix.php }}

- name: 📥 Install dependencies
if: steps.cached-composer-dependencies.outputs.cache-hit != 'true'
run: composer install

- name: 🛠️ Prepare environment
run: |
mkdir -p ./.build/php-cs-fixer
mkdir -p ./.build/phpstan
mkdir -p ./.build/phpunit
- name: 🚨 Run coding standards task
run: make cs-diff
run: composer cs:diff
env:
PHP_CS_FIXER_IGNORE_ENV: true

- name: 🧪 Execute phpunit and pest tests
run: make test

- name: 🔍 Run static analysis using phpstan
run: make stan
env:
PHPSTAN_OUTPUT_FORMAT: github
run: make stan-ci

- name: 📤 Upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
verbose: true

...
29 changes: 29 additions & 0 deletions .github/workflows/create-arch-diagram.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---

# This workflow was added by CodeSee. Learn more at https://codesee.io/
# This is v2.0 of this workflow file

on: # yamllint disable-line rule:truthy
push:
branches:
- develop
pull_request_target:
types:
- opened
- synchronize
- reopened

name: 🤖 CodeSee

permissions: read-all

jobs:
codesee:
uses: wayofdev/gh-actions/.github/workflows/create-arch-diagram.yml@master
with:
os: ubuntu-latest
continue-on-error: true
secrets:
codesee-token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }}

...
36 changes: 10 additions & 26 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,23 @@
---

# https://github.com/wayofdev/gh-actions/blob/master/.github/workflows/create-release.yml
# https://github.com/google-github-actions/release-please-action#release-types-supported

on: # yamllint disable-line rule:truthy
push:
branches:
- master

name: release-please
name: 📦 Create release

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
release-type: node
package-name: laravel-package-tpl
default-branch: master
changelog-types: |
[
{ "type": "feat", "section": "Features", "hidden": false },
{ "type": "fix", "section": "Bug Fixes", "hidden": false },
{ "type": "perf", "section": "Performance Improvements", "hidden": false },
{ "type": "docs", "section": "Documentation", "hidden": false },
{ "type": "chore", "section": "Miscellaneous", "hidden": false },
{ "type": "style", "section": "Styles", "hidden": true },
{ "type": "revert", "section": "Reverts", "hidden": true },
{ "type": "deps", "section": "Dependencies", "hidden": true },
{ "type": "refactor", "section": "Code Refactoring", "hidden": true },
{ "type": "test", "section": "Tests", "hidden": true },
{ "type": "build", "section": "Build System", "hidden": true },
{ "type": "ci", "section": "Continuous Integration", "hidden": true }
]
release:
uses: wayofdev/gh-actions/.github/workflows/create-release.yml@master
with:
os: ubuntu-latest
branch: master
package-name: laravel-package-tpl
secrets:
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}

...
20 changes: 20 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---

on: # yamllint disable-line rule:truthy
pull_request:

name: 🐞 Differential shell-check

permissions:
contents: read

jobs:
shellcheck:
uses: wayofdev/gh-actions/.github/workflows/shellcheck.yml@master
with:
os: ubuntu-latest
severity: warning
secrets:
token: ${{ secrets.GITHUB_TOKEN }}

...
71 changes: 41 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ DOCKER_CMD =

COMPOSER_RUN = $(DOCKER_CMD) composer

# https://phpstan.org/user-guide/output-format
export PHPSTAN_OUTPUT_FORMAT ?= table

# Self documenting Makefile code
# ------------------------------------------------------------------------------------
ifneq ($(TERM),)
BLACK := $(shell tput setaf 0)
RED := $(shell tput setaf 1)
Expand All @@ -29,11 +34,10 @@ else
WHITE := ""
RST := ""
endif
MAKE_LOGFILE = /tmp/wayofdev-laravel-package-tpl.log
MAKE_LOGFILE = /tmpwayofdev-laravel-package-tpl.log
MAKE_CMD_COLOR := $(BLUE)

# https://phpstan.org/user-guide/output-format
export PHPSTAN_OUTPUT_FORMAT ?= table
default: all

help:
@echo 'Management commands for package:'
Expand All @@ -48,13 +52,23 @@ help:
@echo ' 🏢 ${YELLOW}Org wayofdev (github.com/wayofdev)${RST}'
.PHONY: help

.EXPORT_ALL_VARIABLES:


# Default action
# Defines default command when `make` is executed without additional parameters
# ------------------------------------------------------------------------------------
all: install hooks
.PHONY: all


# System Actions
# ------------------------------------------------------------------------------------
prepare:
mkdir -p .build/php-cs-fixer
.PHONY: prepare


# Composer
# ------------------------------------------------------------------------------------
install: ## Installs composer dependencies
Expand All @@ -65,41 +79,38 @@ update: ## Updates composer dependencies by running composer update command
$(COMPOSER_RUN) update
.PHONY: update

# Testing

# Code Quality, Git, Linting, Testing
# ------------------------------------------------------------------------------------
cs-diff: prepare ## Runs php-cs-fixer in dry-run mode and shows diff which will by applied
$(COMPOSER_RUN) cs-diff
.PHONY: cs-diff
hooks: ## Install git hooks from pre-commit-config
pre-commit install
pre-commit autoupdate
.PHONY: hooks

lint-yaml: ## Lints yaml files inside project
yamllint .
.PHONY: lint-yaml

cs-fix: prepare ## Fixes code to follow coding standards using php-cs-fixer
$(COMPOSER_RUN) cs-fix
.PHONY: cs-fix
lint-php: prepare ## Fixes code to follow coding standards using php-cs-fixer
$(COMPOSER_RUN) cs:fix
.PHONY: lint-php

stan: ## Runs phpstan – static analysis tool
lint-diff: prepare ## Runs php-cs-fixer in dry-run mode and shows diff which will by applied
$(COMPOSER_RUN) cs:diff
.PHONY: lint-diff

lint-stan: ## Runs phpstan – static analysis tool
$(COMPOSER_RUN) stan
.PHONY: stan
.PHONY: lint-stan

stan-ci:
$(COMPOSER_RUN) stan-ci
.PHONY: stan-ci
lint-stan-ci:
$(COMPOSER_RUN) stan:ci
.PHONY: lint-stan-ci

test: ## Run project php-unit and pest tests
XDEBUG_MODE=coverage $(COMPOSER_RUN) test
$(COMPOSER_RUN) test
.PHONY: test

test-cc: ## Run project php-unit and pest tests in coverage mode and build report
$(COMPOSER_RUN) test-cc
$(COMPOSER_RUN) test:cc
.PHONY: test-cc

# Yaml Actions
# ------------------------------------------------------------------------------------
lint: ## Lints yaml files inside project
yamllint .
.PHONY: lint

# Git Actions
# ------------------------------------------------------------------------------------
hooks: ## Install git hooks from pre-commit-config
pre-commit install
pre-commit autoupdate
.PHONY: hooks
Loading

0 comments on commit 9c83764

Please sign in to comment.