Skip to content

Commit

Permalink
Setup Github workflows (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
devnix authored Apr 20, 2023
1 parent 0433e58 commit ce5a5d7
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
64 changes: 64 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "avaibooksports/redsys-operations-parser",
"description": "Redsys operations parser",
"type": "library",
"license": "MIT",
"authors": [
Expand Down

0 comments on commit ce5a5d7

Please sign in to comment.