From 551c7f628aba5403466314a20d7dca7a222df105 Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 27 Feb 2024 00:51:16 +0000 Subject: [PATCH] [ci] test shortcuts --- .github/CONTRIBUTING.md | 6 +++--- .github/workflows/tests.yml | 14 +++----------- composer.json | 12 +++++++++++- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 3c69c58a..3d223ecf 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -10,9 +10,9 @@ Testing: ======== Github Actions will be running three sets of automated tests, all of which you can run for yourself: -- `./vendor/bin/php-cs-fixer fix` - keeping a single style for the whole project -- `./vendor/bin/phpunit --config tests/phpunit.xml` - unit testing -- `./vendor/bin/phpstan analyse --memory-limit 1G -c tests/phpstan.neon` - type checking +- `composer format` - keeping a single style for the whole project +- `composer test` - unit testing +- `composer stan` - type checking The `main` branch is locked down so it can't accept pull requests that don't pass these diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5fea9c6d..bf331253 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,7 +31,7 @@ jobs: with: php-version: 8.3 - name: Format - run: ./vendor/bin/php-cs-fixer fix && git diff --exit-code + run: composer format && git diff --exit-code static: name: Static Analysis @@ -50,10 +50,7 @@ jobs: - name: Install PHP dependencies run: composer install --prefer-dist --no-progress - name: PHPStan - uses: php-actions/phpstan@v3 - with: - configuration: tests/phpstan.neon - memory_limit: 1G + run: composer stan upgrade: name: Upgrade from 2.9 ${{ matrix.database }} @@ -140,9 +137,4 @@ jobs: - name: Install PHP dependencies run: composer install --no-progress - name: Run test suite - run: | - if [[ "${{ matrix.php }}" == "8.3" ]]; then - vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover=data/coverage.clover - else - vendor/bin/phpunit --configuration tests/phpunit.xml - fi + run: composer test diff --git a/composer.json b/composer.json index afb0d302..1ee778d7 100644 --- a/composer.json +++ b/composer.json @@ -75,5 +75,15 @@ "ext-zlib": "anti-spam", "ext-xml": "some extensions", "ext-gd": "GD-based thumbnailing" - } + }, + "scripts": { + "check": [ + "@format", + "@stan", + "@test" + ], + "format": "php-cs-fixer fix", + "stan": "phpstan analyse --memory-limit 1G -c tests/phpstan.neon", + "test": "phpunit --config tests/phpunit.xml" + } }