diff --git a/.github/workflows/test-laravel.yml b/.github/workflows/test-laravel.yml new file mode 100644 index 0000000..6dee2d2 --- /dev/null +++ b/.github/workflows/test-laravel.yml @@ -0,0 +1,21 @@ +name: Run Tests + +on: + push: + pull_request: + schedule: + - cron: '0 0 * * *' + +jobs: + build: + runs-on: ubuntu-latest + + name: Test Laravel + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Test + run: | + ./tests/laravel-test.sh diff --git a/tests/laravel-test-baseline.xml b/tests/laravel-test-baseline.xml new file mode 100644 index 0000000..3794183 --- /dev/null +++ b/tests/laravel-test-baseline.xml @@ -0,0 +1,13 @@ + + + + + require base_path('routes/console.php') + + + + + require base_path('routes/channels.php') + + + diff --git a/tests/laravel-test-psalm.xml b/tests/laravel-test-psalm.xml new file mode 100644 index 0000000..5a6bb4b --- /dev/null +++ b/tests/laravel-test-psalm.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + diff --git a/tests/laravel-test.sh b/tests/laravel-test.sh new file mode 100755 index 0000000..d004e22 --- /dev/null +++ b/tests/laravel-test.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -e + +echo "Cleaning Up" +rm -rf ../laravel/ + +echo "Installing Laravel" +composer create-project --quiet --prefer-dist "laravel/laravel" ../laravel +cd ../laravel/ + +echo "Adding package from source" +sed -e 's|"type": "project",|&"repositories": [ { "type": "path", "url": "../psalm-plugin-laravel" } ],|' -i '' composer.json +COMPOSER_MEMORY_LIMIT=-1 composer require --dev "psalm/plugin-laravel:*" + +echo "Analyzing Laravel" +./vendor/bin/psalm -c ../psalm-plugin-laravel/tests/laravel-test-psalm.xml