generated from moonshine-software/moonshine-package-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
467 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# .github/workflows/lint.yml | ||
|
||
on: [push] | ||
name: Check & fix styling | ||
jobs: | ||
php-cs-fixer: | ||
name: PHP-CS-Fixer | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: PHP-CS-Fixer | ||
uses: docker://oskarstark/php-cs-fixer-ga | ||
with: | ||
args: --config=.php-cs-fixer.dist.php --allow-risky=yes | ||
|
||
- name: Extract branch name | ||
shell: bash | ||
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | ||
id: extract_branch | ||
|
||
- name: Commit changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Fix styling | ||
push_options: '--force' | ||
branch: ${{ steps.extract_branch.outputs.branch }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# github action that checks code with Rector | ||
name: Rector | ||
|
||
on: [push] | ||
|
||
jobs: | ||
rector: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
uses: actions/checkout@v3 | ||
with: | ||
# Must be used to trigger workflow after push | ||
token: ${{ secrets.ACCESS_TOKEN }} | ||
|
||
- | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.2 | ||
coverage: none | ||
|
||
- uses: "ramsey/composer-install@v2" | ||
|
||
- run: vendor/bin/rector process --clear-cache | ||
|
||
- name: Extract branch name | ||
shell: bash | ||
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | ||
id: extract_branch | ||
- | ||
# commit only to core contributors who have repository access | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: '[rector] Rector fixes' | ||
push_options: '--force' | ||
branch: ${{ steps.extract_branch.outputs.branch }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: tests | ||
|
||
on: | ||
push: | ||
pull_request: | ||
types: | ||
- opened | ||
- ready_for_review | ||
- reopened | ||
- synchronize | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
moonshine-tests: | ||
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: true | ||
matrix: | ||
php: [8.2, 8.3] | ||
laravel: [11] | ||
|
||
steps: | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
tools: composer:v2 | ||
coverage: none | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up MySQL | ||
env: | ||
DB_USERNAME: root | ||
DB_PASSWORD: root | ||
DB_DATABASE: tests | ||
run: | | ||
sudo /etc/init.d/mysql start | ||
mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USERNAME }} -p${{ env.DB_PASSWORD }} | ||
- name: Copy phpunit.xml.dist | ||
run: php -r "file_exists('phpunit.xml.dist') || copy('phpunit-example.xml.dist', 'phpunit.xml.dist');" | ||
|
||
- name: Install Dependencies | ||
run: composer install --no-interaction --prefer-dist --optimize-autoloader | ||
|
||
- name: Execute tests via PHPUnit | ||
env: | ||
DB_PASSWORD: root | ||
run: ./vendor/bin/phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ vendor | |
composer.lock | ||
node_modules | ||
.phpunit.result.cache | ||
phpunit.xml.dist | ||
.php-cs-fixer.cache | ||
app | ||
reports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" | ||
beStrictAboutTestsThatDoNotTestAnything="false" colors="true" processIsolation="false" stopOnError="false" | ||
stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.2/phpunit.xsd" | ||
cacheDirectory=".phpunit.cache" backupStaticProperties="false"> | ||
<testsuites> | ||
<testsuite name="Suite"> | ||
<directory suffix="Test.php">./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<php> | ||
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/> | ||
<ini name="date.timezone" value="UTC"/> | ||
<ini name="intl.default_locale" value="C.UTF-8"/> | ||
<ini name="memory_limit" value="2048M"/> | ||
<env name="DB_CONNECTION" value="testing"/> | ||
<!-- | ||
<env name="REDIS_HOST" value="127.0.0.1" /> | ||
<env name="REDIS_PORT" value="6379" /> | ||
--> | ||
</php> | ||
<source> | ||
<include> | ||
<directory suffix=".php">src</directory> | ||
</include> | ||
</source> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
beStrictAboutTestsThatDoNotTestAnything="false" | ||
colors="true" | ||
convertDeprecationsToExceptions="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnError="false" | ||
stopOnFailure="false" | ||
verbose="true" | ||
> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" | ||
beStrictAboutTestsThatDoNotTestAnything="false" colors="true" processIsolation="false" stopOnError="false" | ||
stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.2/phpunit.xsd" | ||
cacheDirectory=".phpunit.cache" backupStaticProperties="false"> | ||
<testsuites> | ||
<testsuite name="Suite"> | ||
<directory suffix="Test.php">./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<php> | ||
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/> | ||
|
||
<ini name="date.timezone" value="UTC" /> | ||
<ini name="intl.default_locale" value="C.UTF-8" /> | ||
<ini name="memory_limit" value="2048M" /> | ||
<env name="DB_CONNECTION" value="testing" /> | ||
<ini name="date.timezone" value="UTC"/> | ||
<ini name="intl.default_locale" value="C.UTF-8"/> | ||
<ini name="memory_limit" value="2048M"/> | ||
<env name="DB_CONNECTION" value="testing"/> | ||
<!-- | ||
<env name="REDIS_HOST" value="127.0.0.1" /> | ||
<env name="REDIS_PORT" value="6379" /> | ||
--> | ||
<env name="REDIS_HOST" value="127.0.0.1" /> | ||
<env name="REDIS_PORT" value="6379" /> | ||
--> | ||
</php> | ||
<coverage> | ||
<source> | ||
<include> | ||
<directory suffix=".php">src</directory> | ||
</include> | ||
</coverage> | ||
</source> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector; | ||
use Rector\Config\RectorConfig; | ||
use Rector\Php81\Rector\Array_\FirstClassCallableRector; | ||
use Rector\Set\ValueObject\LevelSetList; | ||
use Rector\Set\ValueObject\SetList; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig->paths([ | ||
__DIR__ . '/src', | ||
]); | ||
|
||
$rectorConfig->skip([ | ||
__DIR__ . '/app', | ||
__DIR__ . '/public', | ||
__DIR__ . '/resources', | ||
__DIR__ . '/vendor', | ||
__DIR__ . '/stubs', | ||
__DIR__ . '/tests', | ||
ExplicitBoolCompareRector::class, | ||
FirstClassCallableRector::class, | ||
]); | ||
|
||
$rectorConfig->importNames(); | ||
$rectorConfig->importShortClasses(); | ||
$rectorConfig->removeUnusedImports(); | ||
|
||
$rectorConfig->sets([ | ||
LevelSetList::UP_TO_PHP_82, | ||
SetList::CODE_QUALITY, | ||
SetList::DEAD_CODE, | ||
SetList::TYPE_DECLARATION, | ||
]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.