Skip to content

Commit 0a6f49a

Browse files
JasonBenettclaude
andcommitted
chore: add CI workflow and contributing guidelines
Add comprehensive GitHub Actions CI workflow that runs on all pushes and pull requests: - Test matrix across PHP 8.2, 8.3, and 8.4 - PHPStan static analysis at max level - Code style validation (PER Coding Style 3.0) - Unit tests with mocked dependencies - Functional tests against real WireMock server - Code coverage reporting with Codecov integration - WireMock service container with health checks - Composer dependency caching for faster builds Add CONTRIBUTING.md with detailed guidelines for contributors: - Development workflow and setup instructions - Code quality standards (PHPStan, code style) - Testing requirements and best practices - Semantic commit message conventions - Pull request process and templates - Code style guidelines with PHPDoc examples - Recognition for contributors The CI workflow ensures all quality checks must pass before merge, maintaining high code quality standards across all PHP versions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4a613cd commit 0a6f49a

File tree

4 files changed

+511
-3
lines changed

4 files changed

+511
-3
lines changed

.github/workflows/ci.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
tests:
11+
name: PHP ${{ matrix.php-version }} Tests
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
php-version: ['8.2', '8.3', '8.4']
18+
19+
services:
20+
wiremock:
21+
image: wiremock/wiremock:latest
22+
ports:
23+
- 8080:8080
24+
options: >-
25+
--health-cmd "curl -f http://localhost:8080/__admin/health || exit 1"
26+
--health-interval 10s
27+
--health-timeout 5s
28+
--health-retries 5
29+
--health-start-period 10s
30+
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
35+
- name: Setup PHP
36+
uses: shivammathur/setup-php@v2
37+
with:
38+
php-version: ${{ matrix.php-version }}
39+
extensions: json, mbstring
40+
coverage: none
41+
tools: composer:v2
42+
43+
- name: Validate composer.json and composer.lock
44+
run: composer validate --strict
45+
46+
- name: Cache Composer dependencies
47+
uses: actions/cache@v4
48+
with:
49+
path: vendor
50+
key: ${{ runner.os }}-php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
51+
restore-keys: |
52+
${{ runner.os }}-php-${{ matrix.php-version }}-composer-
53+
54+
- name: Install dependencies
55+
run: composer install --prefer-dist --no-progress --no-suggest
56+
57+
- name: Wait for WireMock to be ready
58+
run: |
59+
timeout 30 bash -c 'until curl -f http://localhost:8080/__admin/health; do sleep 1; done'
60+
61+
- name: Run PHPStan
62+
run: composer phpstan
63+
64+
- name: Run code style check
65+
run: composer cs-check
66+
67+
- name: Run unit tests
68+
run: composer test
69+
70+
- name: Build Codeception support classes
71+
run: vendor/bin/codecept build
72+
73+
- name: Run functional tests
74+
run: composer test:functional
75+
76+
code-coverage:
77+
name: Code Coverage
78+
runs-on: ubuntu-latest
79+
80+
services:
81+
wiremock:
82+
image: wiremock/wiremock:latest
83+
ports:
84+
- 8080:8080
85+
options: >-
86+
--health-cmd "curl -f http://localhost:8080/__admin/health || exit 1"
87+
--health-interval 10s
88+
--health-timeout 5s
89+
--health-retries 5
90+
--health-start-period 10s
91+
92+
steps:
93+
- name: Checkout code
94+
uses: actions/checkout@v4
95+
96+
- name: Setup PHP
97+
uses: shivammathur/setup-php@v2
98+
with:
99+
php-version: '8.2'
100+
extensions: json, mbstring
101+
coverage: xdebug
102+
tools: composer:v2
103+
104+
- name: Install dependencies
105+
run: composer install --prefer-dist --no-progress --no-suggest
106+
107+
- name: Wait for WireMock to be ready
108+
run: |
109+
timeout 30 bash -c 'until curl -f http://localhost:8080/__admin/health; do sleep 1; done'
110+
111+
- name: Build Codeception support classes
112+
run: vendor/bin/codecept build
113+
114+
- name: Run unit tests with coverage
115+
run: vendor/bin/phpunit --coverage-clover coverage-unit.xml
116+
117+
- name: Run functional tests with coverage
118+
run: vendor/bin/codecept run functional --coverage-xml
119+
120+
- name: Upload coverage to Codecov
121+
uses: codecov/codecov-action@v5
122+
with:
123+
files: ./coverage-unit.xml,./tests/_output/coverage.xml
124+
flags: unittests,functional
125+
fail_ci_if_error: false
126+
env:
127+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)