From ce5a5d7a1bbafdee4accb385e7e0d5217fc37ef2 Mon Sep 17 00:00:00 2001 From: Pablo Largo Mohedano Date: Thu, 20 Apr 2023 15:15:59 +0200 Subject: [PATCH] Setup Github workflows (#1) --- .github/workflows/ci.yaml | 64 +++++++++++++++++++++++++++++++++++++++ Makefile | 6 +++- composer.json | 1 + 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..703ec0d --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,64 @@ +name: CI + +on: + push: + pull_request: + +permissions: + contents: read + + +jobs: + PHPUnit: + name: PHPUnit (PHP ${{ matrix.php }}) + runs-on: ubuntu-22.04 + strategy: + matrix: + php: + - 8.2 + - 8.1 + - 8.0 + - 7.4 + steps: + - uses: actions/checkout@v3 + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: xdebug + env: + fail-fast: true # fail step if any extension can not be installed + - run: composer install + - run: vendor/bin/phpunit --coverage-text + + quality-tools: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v3 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run PHPStan + run: vendor/bin/phpstan + + - name: Run Psalm + run: vendor/bin/psalm + + - name: Run php-cs-fixer + run: vendor/bin/php-cs-fixer fix --diff --dry-run + + - name: Run Rector + run: vendor/bin/rector process --dry-run diff --git a/Makefile b/Makefile index 12ec2b6..9374a2b 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,10 @@ help: ## Show this help. @printf "\033[33mUsage:\033[0m\n make [target] [arg=\"val\"...]\n\n\033[33mTargets:\033[0m\n" @grep -E '^[-a-zA-Z0-9_\.\/]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-30s\033[0m %s\n", $$1, $$2}' +.PHONY: composer +composer: + composer validate --strict + .PHONY: test test: vendor/bin/phpunit @@ -33,4 +37,4 @@ rector-dry: vendor/bin/rector process --dry-run .PHONY: ci -ci: phpstan psalm test rector-dry fix-dry +ci: composer phpstan psalm test rector-dry fix-dry diff --git a/composer.json b/composer.json index 7d5d5e6..c682f58 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,6 @@ { "name": "avaibooksports/redsys-operations-parser", + "description": "Redsys operations parser", "type": "library", "license": "MIT", "authors": [