Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies, install Psalm #33

Merged
merged 2 commits into from
Feb 28, 2024
Merged
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
34 changes: 34 additions & 0 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Psalm

on:
push:
paths:
- '**.php'
- 'psalm*'

jobs:
psalm:
name: psalm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: vendor
key: composer-${{ hashFiles('composer.json') }}

- name: Run composer install
run: |
composer config "http-basic.nova.laravel.com" "${{ secrets.NOVA_USERNAME }}" "${{ secrets.NOVA_4_LICENSE_KEY }}"
composer install -n --prefer-dist

- name: Run Psalm
run: ./vendor/bin/psalm --shepherd
25 changes: 21 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [ 8.1, 8.2 ]
php: [ 8.3, 8.2]
laravel: [ 10.* ]
testbench: [ 8.* ]
dependency-version: [ prefer-stable ]
include:
- laravel: 10.*
testbench: 8.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout code
uses: actions/checkout@v2
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

- name: Setup problem matchers
Expand All @@ -41,3 +42,19 @@ jobs:

- name: Execute tests
run: composer test

# NPM part (test whether assets can be compiled)
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache yarn dependencies
uses: actions/cache@v4
id: npm-node_modules-cache
with:
path: node_modules
key: npm-${{ hashFiles('package.json') }}-node-20

- name: Compile assets
run: npm install && npm run nova:install && npm run prod
15 changes: 11 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
{
"name": "interaction-design-foundation/nova-unlayer-field",
"description": "A Laravel Nova field for Unlayer to compose emails and landing pages.",
"license": "MIT",
"keywords": [
"laravel",
"nova",
"laravel-nova-field",
"html"
],
"license": "MIT",
"require": {
"php": ">=8.1",
"php": "^8.1",
"ext-json": "*",
"laravel/nova": "^4.20"
},
"require-dev": {
"interaction-design-foundation/coding-standard": "^0.2.0",
"orchestra/testbench": "^8.3",
"phpunit/phpunit": "^10.0"
"phpunit/phpunit": "^10.5 || ^11.0",
"vimeo/psalm": "^5.22"
},
"repositories": [
{
Expand All @@ -40,7 +42,8 @@
},
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true
"ergebnis/composer-normalize": true,
"dealerdirect/phpcodesniffer-composer-installer": true
},
"sort-packages": true
},
Expand All @@ -52,6 +55,10 @@
}
},
"scripts": {
"cs": "@cs:fix",
"cs:check": "phpcs -p -s --colors --report-full --report-summary",
"cs:fix": "phpcbf -p --colors",
"psalm": "vendor/bin/psalm",
"test": "phpunit --colors=always"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production",
"nova:install": "npm --prefix='../../vendor/laravel/nova' ci"
"nova:install": "npm --prefix='./vendor/laravel/nova' ci"
},
"devDependencies": {
"@vue/compiler-sfc": "^3.2.33",
Expand Down
42 changes: 21 additions & 21 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
backupGlobals="false"
colors="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
>
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
backupGlobals="false"
colors="true"
processIsolation="false"
stopOnFailure="false"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
</php>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
17 changes: 17 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.22.2@d768d914152dbbf3486c36398802f74e80cfde48">
<file src="src/Unlayer.php">
<MethodSignatureMismatch>
<code><![CDATA[Unlayer]]></code>
</MethodSignatureMismatch>
<MixedArgument>
<code><![CDATA[$request->get($requestAttribute)]]></code>
</MixedArgument>
<MixedAssignment>
<code><![CDATA[$attributeValue]]></code>
</MixedAssignment>
<PropertyNotSetInConstructor>
<code><![CDATA[Unlayer]]></code>
</PropertyNotSetInConstructor>
</file>
</files>
22 changes: 22 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="false"
errorBaseline="psalm-baseline.xml"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<disableExtensions>
<extension name="random"/>
<extension name="redis"/>
</disableExtensions>
</psalm>