Skip to content

Commit 87113ff

Browse files
authored
Align the tooling with the ecosystem standard. (#14)
1 parent 48114d6 commit 87113ff

7 files changed

Lines changed: 61 additions & 50 deletions

File tree

‎.gitattributes‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
*.php text diff=php
44

5-
# Keep Claude tooling scripts out of GitHub's language statistics
6-
75
# Dev-only, excluded from the Packagist tarball
86
/.github export-ignore
97
/tests export-ignore

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ Closes #...
1212

1313
- [ ] Tests added or updated.
1414
- [ ] Documentation updated when applicable.
15-
- [ ] `composer review` passes.
16-
- [ ] `composer tests` passes.
15+
- [ ] `make review` passes.
16+
- [ ] `make tests` passes.

‎.github/copilot-instructions.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
## Context
44

5-
PHP library (tiny-blocks). Immutable domain models, zero infrastructure dependencies in core.
5+
PHP library in the tiny-blocks ecosystem.
66

77
## Mandatory pre-task step
88

9-
Before starting any task, read and strictly follow all instruction files located in `.claude/CLAUDE.md` and
10-
`.claude/rules/`. These files are the absolute source of truth for code generation. Apply every rule strictly. Do not
11-
deviate from the patterns, folder structure, or naming conventions defined in them.
9+
Before starting any task, read and strictly follow `.claude/CLAUDE.md` and every rule file in
10+
`.claude/rules/`. These files are the absolute source of truth for code generation. Apply every
11+
rule strictly. Do not deviate from the patterns, folder structure, or naming conventions defined
12+
in them.

‎.github/workflows/ci.yml‎

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,47 @@ name: CI
33
on:
44
pull_request:
55

6+
concurrency:
7+
group: ci-${{ github.event.pull_request.number }}
8+
cancel-in-progress: true
9+
610
permissions:
711
contents: read
812

9-
env:
10-
PHP_VERSION: '8.5'
11-
1213
jobs:
14+
resolve-tooling-image:
15+
name: Resolve tooling image
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 5
18+
outputs:
19+
php-image: ${{ steps.config.outputs.php-image }}
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v7
23+
24+
- name: Resolve tooling image from the Makefile
25+
id: config
26+
run: echo "php-image=$(make show-image)" >> "$GITHUB_OUTPUT"
27+
1328
build:
1429
name: Build
30+
needs: resolve-tooling-image
1531
runs-on: ubuntu-latest
16-
32+
timeout-minutes: 15
33+
env:
34+
image: ${{ needs.resolve-tooling-image.outputs.php-image }}
35+
workspace: /var/www/html
1736
steps:
1837
- name: Checkout
1938
uses: actions/checkout@v7
2039

21-
- name: Configure PHP
22-
uses: shivammathur/setup-php@v2
23-
with:
24-
php-version: ${{ env.PHP_VERSION }}
25-
tools: composer:2
26-
2740
- name: Validate composer.json
28-
run: composer validate --no-interaction
41+
run: docker run --rm -v "${PWD}":${{ env.workspace }} ${{ env.image }} composer validate --no-interaction
2942

3043
- name: Install dependencies
31-
run: composer install --no-progress --optimize-autoloader --prefer-dist --no-interaction
44+
run: >
45+
docker run --rm -v "${PWD}":${{ env.workspace }} ${{ env.image }}
46+
composer install --no-progress --optimize-autoloader --prefer-dist --no-interaction
3247
3348
- name: Upload vendor and composer.lock as artifact
3449
uses: actions/upload-artifact@v7
@@ -40,48 +55,36 @@ jobs:
4055
4156
auto-review:
4257
name: Auto review
58+
needs: [resolve-tooling-image, build]
4359
runs-on: ubuntu-latest
44-
needs: build
45-
60+
timeout-minutes: 15
4661
steps:
4762
- name: Checkout
4863
uses: actions/checkout@v7
4964

50-
- name: Configure PHP
51-
uses: shivammathur/setup-php@v2
52-
with:
53-
php-version: ${{ env.PHP_VERSION }}
54-
tools: composer:2
55-
5665
- name: Download vendor artifact from build
5766
uses: actions/download-artifact@v8
5867
with:
5968
name: vendor-artifact
6069
path: .
6170

6271
- name: Run review
63-
run: composer review
72+
run: make review
6473

6574
tests:
6675
name: Tests
76+
needs: [resolve-tooling-image, auto-review]
6777
runs-on: ubuntu-latest
68-
needs: auto-review
69-
78+
timeout-minutes: 15
7079
steps:
7180
- name: Checkout
7281
uses: actions/checkout@v7
7382

74-
- name: Configure PHP
75-
uses: shivammathur/setup-php@v2
76-
with:
77-
php-version: ${{ env.PHP_VERSION }}
78-
tools: composer:2
79-
8083
- name: Download vendor artifact from build
8184
uses: actions/download-artifact@v8
8285
with:
8386
name: vendor-artifact
8487
path: .
8588

8689
- name: Run tests
87-
run: composer tests
90+
run: make tests

‎Makefile‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ endif
88

99
TTY := $(shell [ -t 0 ] && echo -it)
1010

11-
DOCKER_RUN = docker run ${PLATFORM} --rm ${TTY} --net=host -v ${PWD}:/app -w /app gustavofreze/php:8.5-alpine
11+
PHP_VERSION := $(shell sed -n 's/.*"php": *"^\([0-9]*\.[0-9]*\)".*/\1/p' composer.json)
12+
IMAGE_VERSION := 1.0.0
13+
PHP_IMAGE := gustavofreze/php:${PHP_VERSION}-cli-${IMAGE_VERSION}
14+
WORKSPACE := /var/www/html
15+
16+
DOCKER_RUN = docker run ${PLATFORM} --rm ${TTY} --net=host -v ${PWD}:${WORKSPACE} ${PHP_IMAGE}
1217

1318
RESET := \033[0m
1419
GREEN := \033[0;32m
@@ -44,6 +49,10 @@ show-reports: ## Open coverage and mutation reports in the browser
4449
show-outdated: ## Show outdated direct dependencies
4550
@${DOCKER_RUN} composer outdated --direct
4651

52+
.PHONY: show-image
53+
show-image: ## Show the pinned PHP tooling image
54+
@echo ${PHP_IMAGE}
55+
4756
.PHONY: clean
4857
clean: ## Remove dependencies and generated artifacts
4958
@sudo chown -R ${USER}:${USER} ${PWD}
@@ -66,7 +75,7 @@ help: ## Display this help message
6675
| awk 'BEGIN {FS = ":.*?## "}; {printf "$(YELLOW)%-25s$(RESET) %s\n", $$1, $$2}'
6776
@echo ""
6877
@echo "$$(printf '$(GREEN)')Reports$$(printf '$(RESET)')"
69-
@grep -E '^(show-reports|show-outdated):.*?## .*$$' $(MAKEFILE_LIST) \
78+
@grep -E '^(show-reports|show-outdated|show-image):.*?## .*$$' $(MAKEFILE_LIST) \
7079
| awk 'BEGIN {FS = ":.*?## "}; {printf "$(YELLOW)%-25s$(RESET) %s\n", $$1, $$2}'
7180
@echo ""
7281
@echo "$$(printf '$(GREEN)')Cleanup$$(printf '$(RESET)')"

‎composer.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"ergebnis/composer-normalize": true,
4949
"infection/extension-installer": true
5050
},
51+
"process-timeout": 0,
5152
"sort-packages": true
5253
},
5354
"scripts": {

‎phpstan.neon.dist‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
parameters:
2-
paths:
3-
- src
4-
- tests
5-
level: max
6-
tmpDir: reports/phpstan
7-
reportUnmatchedIgnoredErrors: true
8-
ignoreErrors:
9-
-
10-
identifier: missingType.iterableValue
11-
path: tests/*
2+
level: max
3+
paths:
4+
- src
5+
- tests
6+
tmpDir: reports/phpstan
7+
ignoreErrors:
8+
- identifier: missingType.iterableValue
9+
path: tests/*
10+
reportUnmatchedIgnoredErrors: true

0 commit comments

Comments
 (0)