Skip to content

Commit aed8e50

Browse files
authored
Merge pull request #75 from yoeunes/dev
Enhances Regex Parsing and Development Environment
2 parents 78991b7 + 7593115 commit aed8e50

32 files changed

+898
-615
lines changed

.editorconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# Top-most EditorConfig file
14
root = true
25

6+
# All files
37
[*]
48
charset = utf-8
59
end_of_line = lf
@@ -8,3 +12,24 @@ indent_style = space
812
insert_final_newline = true
913
max_line_length = 120
1014
tab_width = 4
15+
trim_trailing_whitespace = true
16+
17+
# PHP files
18+
[*.php]
19+
indent_size = 4
20+
indent_style = space
21+
22+
# YAML files
23+
[*.{yml,yaml}]
24+
indent_size = 2
25+
indent_style = space
26+
27+
# Markdown files
28+
[*.md]
29+
max_line_length = off
30+
trim_trailing_whitespace = false
31+
32+
# JSON files
33+
[*.json]
34+
indent_size = 2
35+
indent_style = space

.gitattributes

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,47 @@
1-
# Normalize line endings
1+
# Git Attributes Configuration
2+
# https://git-scm.com/docs/gitattributes
3+
4+
# Normalize line endings to LF for all text files
25
* text=auto eol=lf
36

4-
# Ignore dev files in Composer export
5-
/.github export-ignore
6-
/.idea export-ignore
7-
/.vscode export-ignore
8-
/.cache export-ignore
9-
/.editorconfig export-ignore
10-
/.gitattributes export-ignore
11-
/.gitignore export-ignore
12-
/.php-cs-fixer.php export-ignore
13-
/.php-cs-fixer.cache export-ignore
14-
/phpbench.yml export-ignore
15-
/phpbench.json export-ignore
16-
/phpstan.neon export-ignore
17-
/phpstan.dist.neon export-ignore
18-
/rector.php export-ignore
19-
/phpunit.xml export-ignore
20-
/phpunit.xml.dist export-ignore
21-
/validate_library.php export-ignore
7+
# Binary files
8+
*.pdf binary
9+
10+
# Export-ignore patterns (for composer archive)
11+
# Development and CI/CD files
12+
/.github export-ignore
13+
/.idea export-ignore
14+
/.vscode export-ignore
15+
/.cache export-ignore
16+
17+
# Configuration files
18+
/.editorconfig export-ignore
19+
/.gitattributes export-ignore
20+
/.gitignore export-ignore
21+
/.php-cs-fixer.dist.php export-ignore
22+
/.php-cs-fixer.cache export-ignore
23+
/.phplint.yml export-ignore
24+
/.php-version export-ignore
25+
/.gitmessage export-ignore
26+
27+
# Development tools and configs
28+
/phpbench.yml export-ignore
29+
/phpbench.json export-ignore
30+
/phpstan.neon export-ignore
31+
/phpstan.dist.neon export-ignore
32+
/rector.php export-ignore
33+
/phpunit.xml export-ignore
34+
/phpunit.xml.dist export-ignore
35+
/extension.neon export-ignore
36+
37+
# Directories not needed in distribution
38+
/bin export-ignore
39+
/config export-ignore
40+
/docs export-ignore
41+
/examples export-ignore
42+
/templates export-ignore
43+
/tests export-ignore
44+
/tools export-ignore
2245

23-
# Directories to ignore
24-
/bin export-ignore
25-
/config export-ignore
26-
/examples export-ignore
27-
/docs export-ignore
28-
/tests export-ignore
29-
/tools export-ignore
30-
/.docker export-ignore
31-
/docker export-ignore
46+
# PHP files
47+
*.php text eol=lf diff=php

.github/workflows/ci.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
quality:
11+
name: Code Quality (PHP ${{ matrix.php-version }})
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php-version: ['8.4']
17+
18+
steps:
19+
- name: Checkout Code
20+
uses: actions/checkout@v6
21+
22+
- name: Setup PHP ${{ matrix.php-version }}
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: ${{ matrix.php-version }}
26+
extensions: mbstring, intl, pcre, tokenizer, xml
27+
ini-values: error_reporting=E_ALL
28+
tools: composer:v2
29+
coverage: xdebug
30+
31+
- name: Install Dependencies
32+
run: composer install --no-interaction --no-progress --prefer-dist
33+
34+
- name: Install Tools
35+
run: |
36+
composer install -d tools/phpstan --no-interaction --no-progress
37+
composer install -d tools/rector --no-interaction --no-progress
38+
composer install -d tools/php-cs-fixer --no-interaction --no-progress
39+
composer install -d tools/phplint --no-interaction --no-progress
40+
41+
- name: PHPLint (Syntax Check)
42+
run: ./bin/phplint
43+
44+
- name: Rector (Code Optimization)
45+
run: ./bin/rector process --dry-run --ansi
46+
47+
- name: PHP-CS-Fixer (Code Style)
48+
run: ./bin/php-cs-fixer fix --dry-run --diff
49+
50+
- name: PHPStan (Static Analysis)
51+
run: ./bin/phpstan analyse
52+
53+
test:
54+
name: Tests (PHP ${{ matrix.php-version }}, ${{ matrix.os }})
55+
runs-on: ${{ matrix.os }}
56+
strategy:
57+
fail-fast: false
58+
matrix:
59+
os: [ubuntu-latest]
60+
php-version: ['8.4']
61+
62+
steps:
63+
- name: Checkout Code
64+
uses: actions/checkout@v6
65+
66+
- name: Setup PHP ${{ matrix.php-version }}
67+
uses: shivammathur/setup-php@v2
68+
with:
69+
php-version: ${{ matrix.php-version }}
70+
extensions: mbstring, intl, pcre, tokenizer, xml
71+
ini-values: error_reporting=E_ALL
72+
tools: composer:v2
73+
coverage: xdebug
74+
75+
- name: Install Dependencies
76+
run: composer install --no-interaction --no-progress --prefer-dist
77+
78+
- name: Install Tools
79+
run: |
80+
cd tools/phpstan && composer install --no-interaction --no-progress
81+
cd ../rector && composer install --no-interaction --no-progress
82+
cd ../php-cs-fixer && composer install --no-interaction --no-progress
83+
cd ../phplint && composer install --no-interaction --no-progress
84+
85+
- name: Run Unit Tests
86+
run: ./vendor/bin/phpunit tests/Unit/ --colors=always
87+
88+
- name: Run Integration Tests
89+
run: ./vendor/bin/phpunit tests/Integration/ --colors=always
90+
91+
- name: Generate Coverage Report
92+
run: ./vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml
93+
94+
- name: Upload Coverage to Codecov
95+
uses: codecov/codecov-action@v5
96+
with:
97+
files: ./coverage.xml
98+
fail_ci_if_error: false
99+
100+
validation:
101+
name: Validation & Feature Completeness
102+
runs-on: ubuntu-latest
103+
104+
steps:
105+
- name: Checkout Code
106+
uses: actions/checkout@v6
107+
108+
- name: Setup PHP 8.4
109+
uses: shivammathur/setup-php@v2
110+
with:
111+
php-version: '8.4'
112+
extensions: mbstring, intl, pcre, tokenizer, xml
113+
tools: composer:v2
114+
115+
- name: Install Dependencies
116+
run: composer install --no-interaction --no-progress --prefer-dist
117+
118+
- name: Install Tools
119+
run: |
120+
cd tools/phpstan && composer install --no-interaction --no-progress
121+
cd ../rector && composer install --no-interaction --no-progress
122+
cd ../php-cs-fixer && composer install --no-interaction --no-progress
123+
cd ../phplint && composer install --no-interaction --no-progress
124+
125+
- name: Run Library Validation
126+
run: php tests/validate_library.php
127+
128+
- name: Run PCRE Feature Completeness Tests
129+
run: ./vendor/bin/phpunit tests/Integration/PcreFeatureCompletenessTest.php --testdox
130+
131+
- name: Run ReDoS Detection Tests
132+
run: ./vendor/bin/phpunit tests/Integration/ReDoSEdgeCasesTest.php --testdox

.github/workflows/lint.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
release:
10+
name: Create Release
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout Code
15+
uses: actions/checkout@v6
16+
17+
- name: Setup PHP 8.4
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: '8.4'
21+
extensions: mbstring, intl, pcre, tokenizer, xml
22+
tools: composer:v2
23+
24+
- name: Install Dependencies
25+
run: composer install --no-interaction --no-progress --prefer-dist --no-dev
26+
27+
- name: Run Tests
28+
run: ./vendor/bin/phpunit --colors=always
29+
30+
- name: Run PHPStan
31+
run: ./bin/phpstan analyse
32+
33+
- name: Generate Changelog
34+
id: changelog
35+
run: |
36+
# Extract version from tag
37+
VERSION=${GITHUB_REF#refs/tags/v}
38+
echo "version=$VERSION" >> $GITHUB_OUTPUT
39+
40+
# Generate basic changelog from commits since last tag
41+
echo "## Changes" > changelog.md
42+
git log --oneline --pretty=format="- %s" $(git describe --tags --abbrev=0 HEAD^)..HEAD >> changelog.md
43+
echo "" >> changelog.md
44+
echo "Full changelog: https://github.com/${{ github.repository }}/compare/$(git describe --tags --abbrev=0 HEAD^)..$VERSION" >> changelog.md
45+
46+
- name: Create Archive
47+
run: |
48+
mkdir -p build
49+
composer archive --format=zip --file=regex-parser-${{ steps.changelog.outputs.version }}
50+
mv regex-parser-${{ steps.changelog.outputs.version }}.zip build/
51+
52+
- name: Create GitHub Release
53+
uses: actions/create-release@v1
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
with:
57+
tag_name: ${{ github.ref }}
58+
release_name: Release ${{ steps.changelog.outputs.version }}
59+
body_path: changelog.md
60+
draft: false
61+
prerelease: false
62+
63+
- name: Upload Release Assets
64+
uses: actions/upload-release-asset@v1
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
with:
68+
upload_url: ${{ steps.create_release.outputs.upload_url }}
69+
asset_path: build/regex-parser-${{ steps.changelog.outputs.version }}.zip
70+
asset_name: regex-parser-${{ steps.changelog.outputs.version }}.zip
71+
asset_content_type: application/zip

0 commit comments

Comments
 (0)