Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: code-quality

on:
push:
paths:
- '**.php'
- '.github/workflows/code-quality.yml'
- 'composer.json'
- 'composer.lock'
- 'phpstan.neon.dist'
pull_request:
paths:
- '**.php'
- '.github/workflows/code-quality.yml'
- 'composer.json'
- 'composer.lock'
- 'phpstan.neon.dist'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, intl, fileinfo
coverage: none

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

- name: Run PHPStan
run: composer analyse -- --error-format=github

pint:
name: PHP Code Style (Pint)
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, intl, fileinfo
coverage: none

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

- name: Check code style
run: vendor/bin/pint --test

composer-validate:
name: Validate composer.json
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read

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

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

- name: Validate composer.json
run: composer validate --strict

security-audit:
name: Security Audit
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read

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

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

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

- name: Check for security vulnerabilities
run: composer audit
47 changes: 47 additions & 0 deletions .github/workflows/fix-php-code-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: fix-php-code-style

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

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
fix-code-style:
name: Fix PHP Code Style
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write
# Only run on PRs from the same repository (not forks), since we need write access
if: github.event.pull_request.head.repo.full_name == github.repository

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, intl, fileinfo
coverage: none

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

- name: Run Pint (auto-fix)
run: vendor/bin/pint

- name: Commit style fixes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: apply automatic PHP code style fixes"
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
skip_dirty_check: false
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: release

on:
push:
tags:
- 'v*.*.*'

permissions:
contents: write

jobs:
release:
name: Create Release
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, intl, fileinfo
coverage: none

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

- name: Run tests before release
run: vendor/bin/pest --ci

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 changes: 28 additions & 8 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,36 @@ concurrency:

jobs:
test:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.4, 8.3]
laravel: [12.*, 11.*]
php: [8.4, 8.3, 8.2]
laravel: [13.*, 12.*, 11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 13.*
testbench: 11.*
- laravel: 12.*
testbench: 10.*
- laravel: 11.*
testbench: 9.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }}

steps:
- name: Checkout code
uses: actions/checkout@v5
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: none
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, fileinfo
coverage: xdebug

- name: Setup problem matchers
run: |
Expand All @@ -63,3 +66,20 @@ jobs:
- name: List Installed Dependencies
run: composer show -D

- name: Execute tests
run: vendor/bin/pest --ci --coverage --coverage-clover=coverage.xml

- name: Upload coverage to Codecov
if: matrix.php == '8.4' && matrix.laravel == '13.*' && matrix.stability == 'prefer-stable'
uses: codecov/codecov-action@v5
with:
files: coverage.xml
fail_ci_if_error: false

- name: Upload test results artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-php${{ matrix.php }}-laravel${{ matrix.laravel }}-${{ matrix.stability }}
path: coverage.xml
retention-days: 7
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Logger

[![Tests](https://github.com/barsch123/activity/actions/workflows/run-tests.yml/badge.svg)](https://github.com/barsch123/activity/actions/workflows/run-tests.yml)
[![Code Quality](https://github.com/barsch123/activity/actions/workflows/code-quality.yml/badge.svg)](https://github.com/barsch123/activity/actions/workflows/code-quality.yml)
[![Packagist Version](https://img.shields.io/packagist/v/gottvergessen/activity.svg?style=flat-square)](https://packagist.org/packages/gottvergessen/activity)
[![License](https://img.shields.io/packagist/l/gottvergessen/activity.svg?style=flat-square)](LICENSE.md)

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"spatie/laravel-package-tools": "^1.16"
},
"require-dev": {
"larastan/larastan": "^3.0",
"laravel/pint": "^1.14",
"nunomaduro/collision": "^8.8",
"orchestra/testbench": "^11.0.0||^10.0.0||^9.0.0",
Expand Down
12 changes: 12 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
includes:
- vendor/larastan/larastan/extension.neon

parameters:
paths:
- src

level: 9

ignoreErrors:

excludePaths:
Loading