Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yourivw committed Apr 1, 2024
0 parents commit d7757ff
Show file tree
Hide file tree
Showing 46 changed files with 16,684 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

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

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text=auto

/.github export-ignore
/tests export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
phpstan.neon export-ignore
phpunit.xml export-ignore
pint.json export-ignore
testbench.yaml export-ignore
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
reviewers:
- "yourivw"
labels:
- "changelog:maintenance"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
reviewers:
- "yourivw"
labels:
- "changelog:maintenance"
43 changes: 43 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: Added
labels:
- 'changelog:added'
- title: Changed
labels:
- 'changelog:changed'
- title: Deprecated
labels:
- 'changelog:deprecated'
- title: Removed
labels:
- 'changelog:removed'
- title: Fixed
labels:
- 'changelog:fixed'
- title: Security
labels:
- 'changelog:security'
- title: 'Maintenance & updates'
labels:
- 'changelog:maintenance'
change-template: '- $TITLE @$AUTHOR ([#$NUMBER](https://github.com/yourivw/sailor/pull/$NUMBER))'
version-resolver:
major:
labels:
- 'changelog:removed'
minor:
labels:
- 'changelog:added'
- 'changelog:deprecated'
patch:
labels:
- 'changelog:fixed'
- 'changelog:security'
- 'changelog:maintenance'
default: patch
template: |
$CHANGES
exclude-labels:
- 'changelog:ignore'
50 changes: 50 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Analyse code coverage

on:
push:
branches:
- main
paths:
- src/**/*.php

permissions:
contents: write

jobs:
coverage:
name: Analyse code coverage
runs-on: ubuntu-latest
timeout-minutes: 10

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

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

- name: Run composer install
run: |
composer require "laravel/framework:11.*" --no-interaction --no-update
composer install --prefer-dist --no-interaction
- name: Run PHPUnit tests with coverage
run: ./vendor/bin/phpunit --coverage-clover clover.xml

- name: Generate test coverage badge
uses: timkrase/phpunit-coverage-badge@v1.2.1
with:
coverage_badge_path: 'output/badge-coverage.svg'
push_badge: false

- name: Git push badge to image-data branch
uses: peaceiris/actions-gh-pages@v3
with:
publish_dir: ./output
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
26 changes: 26 additions & 0 deletions .github/workflows/dependabot-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Dependabot auto merge

on: pull_request_target

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
name: Dependabot auto merge
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Get Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2.0.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Merge Dependabot PR's for patch and minor updates
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-patch' || 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 }}
31 changes: 31 additions & 0 deletions .github/workflows/pint-formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Pint formatting

on:
pull_request:
paths:
- src/**/*.php

permissions:
contents: write

jobs:
pint:
name: Pint formatting
runs-on: ubuntu-latest
timeout-minutes: 10

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

- name: Run formatting
uses: aglipanci/laravel-pint-action@2.4
with:
configPath: pint.json

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commit_message: 'Pint formatting 🍻'
24 changes: 24 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Draft release

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: write
pull-requests: read

jobs:
draft_release:
name: Draft release
if: github.actor != 'github-actions[bot]' && github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Draft release changes
uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish release

on: workflow_dispatch

permissions:
contents: write

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

steps:
- name: Get draft release
uses: cardinalby/git-get-release-action@v1
id: get_draft_release
env:
GITHUB_TOKEN: ${{ github.token }}
with:
latest: true
draft: true

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

- name: Update changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
release-notes: ${{ steps.get_draft_release.outputs.body }}
latest-version: ${{ steps.get_draft_release.outputs.name }}

- name: Commit updated changelog
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update CHANGELOG.md
file_pattern: CHANGELOG.md

- name: Publish release
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.get_draft_release.outputs.id }}
52 changes: 52 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Run tests

on:
push:
branches:
- main
- '[0-9]+.**'
paths:
- src/**/*.php
- composer.json
- .github/workflows/**
pull_request:
paths:
- src/**/*.php
- composer.json
- .github/workflows/**

jobs:
tests:
name: Run tests on PHP ${{ matrix.php }} and Laravel ${{ matrix.laravel }}
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
php: [8.3, 8.2, 8.1]
laravel: [11.*, 10.*]
exclude:
- laravel: 11.*
php: 8.1

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: composer:v2

- name: Run composer install
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer install --prefer-dist --no-interaction
- name: Run PHPUnit tests
run: ./vendor/bin/phpunit

- name: Run static analysis
run: ./vendor/bin/phpstan --error-format=github
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/.vscode
/coverage
/vendor
/workbench
composer.lock
docker-compose.yml
.phpunit.result.cache
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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).

## [Unreleased](https://github.com/yourivw/sailor/compare/v1.0.0...HEAD)

## [v1.0.0](https://github.com/yourivw/sailor/releases/tag/v1.0.0) - 2024-04-01

- Initial release
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright (c) Youri van Weegberg

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit d7757ff

Please sign in to comment.