Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
30 changes: 24 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,59 @@ permissions:
contents: read

env:
PHP_VERSION: '8.3'
PHP_VERSION: '8.5'

jobs:
auto-review:
name: Auto review
name: Auto review (PHP ${{ env.PHP_VERSION }})
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Configure PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}

- name: Cache Composer
uses: actions/cache@v4
with:
path: |
~/.composer/cache
~/.cache/composer
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
Comment thread
gustavofreze marked this conversation as resolved.
Outdated

- name: Install dependencies
run: composer update --no-progress --optimize-autoloader

- name: Run review
run: composer review

tests:
name: Tests
name: Tests (PHP ${{ env.PHP_VERSION }})
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Use PHP ${{ env.PHP_VERSION }}
- name: Configure PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}

- name: Cache Composer
uses: actions/cache@v4
with:
path: |
~/.composer/cache
~/.cache/composer
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer update --no-progress --optimize-autoloader
Comment thread
gustavofreze marked this conversation as resolved.
Outdated

Expand Down
60 changes: 45 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,38 +1,68 @@
ifeq ($(OS),Windows_NT)
PWD := $(shell cd)
else
PWD := $(shell pwd -L)
endif

PWD := $(CURDIR)
ARCH := $(shell uname -m)
PLATFORM :=

ifeq ($(ARCH),arm64)
PLATFORM := --platform=linux/amd64
endif

DOCKER_RUN = docker run ${PLATFORM} --rm -it --net=host -v ${PWD}:/app -w /app gustavofreze/php:8.3
DOCKER_RUN = docker run ${PLATFORM} --rm -it --net=host -v ${PWD}:/app -w /app gustavofreze/php:8.5-alpine

.PHONY: configure test test-file test-no-coverage review show-reports clean
RESET := \033[0m
GREEN := \033[0;32m
YELLOW := \033[0;33m

configure:
.DEFAULT_GOAL := help

.PHONY: configure
configure: ## Install and optimize Composer dependencies
@${DOCKER_RUN} composer update --optimize-autoloader

test:
.PHONY: test
test: ## Run all tests with coverage
@${DOCKER_RUN} composer tests

test-file:
.PHONY: test-file
test-file: ## Run tests for a specific file (usage: make test-file FILE=path/to/file)
@${DOCKER_RUN} composer test-file ${FILE}

test-no-coverage:
.PHONY: test-no-coverage
test-no-coverage: ## Run all tests without coverage
@${DOCKER_RUN} composer tests-no-coverage

review:
.PHONY: review
review: ## Run code review/static analysis
@${DOCKER_RUN} composer review

show-reports:
.PHONY: show-reports
show-reports: ## Open coverage and mutation reports in browser
@sensible-browser report/coverage/coverage-html/index.html report/coverage/mutation-report.html

clean:
.PHONY: clean
clean: ## Clean generated files and reset permissions
@sudo chown -R ${USER}:${USER} ${PWD}
@rm -rf report vendor .phpunit.cache *.lock

.PHONY: help
help: ## Display this help message
@echo "Usage: make [target]"
@echo ""
@echo "$$(printf '$(GREEN)')Setup$$(printf '$(RESET)')"
@grep -E '^(configure):.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*? ## "}; {printf "$(YELLOW)%-25s$(RESET) %s\n", $$1, $$2}'
@echo ""
@echo "$$(printf '$(GREEN)')Testing$$(printf '$(RESET)')"
@grep -E '^(test|test-file|test-no-coverage):.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf "$(YELLOW)%-25s$(RESET) %s\n", $$1, $$2}'
@echo ""
@echo "$$(printf '$(GREEN)')Quality$$(printf '$(RESET)')"
@grep -E '^(review):.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf "$(YELLOW)%-25s$(RESET) %s\n", $$1, $$2}'
@echo ""
@echo "$$(printf '$(GREEN)')Reports$$(printf '$(RESET)')"
@grep -E '^(show-reports):.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf "$(YELLOW)%-25s$(RESET) %s\n", $$1, $$2}'
@echo ""
@echo "$$(printf '$(GREEN)')Cleanup$$(printf '$(RESET)')"
@grep -E '^(clean):.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf "$(YELLOW)%-25s$(RESET) %s\n", $$1, $$2}'
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
}
},
"require": {
"php": "^8.3",
"php": "^8.5",
Comment thread
gustavofreze marked this conversation as resolved.
"ext-bcmath": "*"
},
"require-dev": {
Expand Down