Skip to content

Commit af628b8

Browse files
authored
refactor: php8.2 support and general performance improvements (#280)
Signed-off-by: Alan Brault <alan.brault@visus.io>
1 parent 48fd7c8 commit af628b8

23 files changed

Lines changed: 2034 additions & 8223 deletions

.editorconfig

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,21 @@ charset = utf-8
55
end_of_line = lf
66
insert_final_newline = true
77
trim_trailing_whitespace = true
8-
9-
[*.{md,json}]
10-
indent_style = space
118
indent_size = 4
9+
indent_style = space
10+
11+
[*.md]
12+
indent_size = 2
13+
tab_width = 2
14+
trim_trailing_whitespace = false
15+
16+
[*.json]
17+
indent_size = 2
18+
tab_width = 2
19+
20+
[*.{yml,yaml}]
21+
indent_size = 2
22+
tab_width = 2
1223

1324
[*.php]
14-
indent_style = space
15-
indent_size = 4
1625
max_line_length = 120

.github/workflows/ci.yml

Lines changed: 114 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,64 +2,142 @@ name: Continuous Integration
22

33
on:
44
push:
5-
branches: [main]
5+
branches:
6+
- main
7+
paths-ignore:
8+
- "**.md"
9+
- "renovate.json"
10+
- ".github/ISSUE_TEMPLATE/**"
11+
- ".github/workflows/release.yml"
12+
613
pull_request:
14+
paths-ignore:
15+
- "**.md"
16+
- "renovate.json"
17+
- ".github/ISSUE_TEMPLATE/**"
18+
- ".github/workflows/release.yml"
719

820
concurrency:
921
group: ${{ github.workflow }}-${{ github.ref }}
1022
cancel-in-progress: true
1123

1224
jobs:
13-
static-analysis:
25+
coding-standards:
26+
name: Coding Standards
1427
runs-on: ubuntu-latest
28+
1529
steps:
16-
- uses: actions/checkout@v6
30+
- name: Checkout
31+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
1732
with:
1833
fetch-depth: 0
1934
show-progress: false
20-
- uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1
35+
36+
- name: Setup PHP
37+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
2138
with:
22-
php-version: '8.4'
39+
php-version: 'latest'
2340
tools: composer
24-
extensions: xdebug
25-
- uses: actions/cache@v4
41+
coverage: none
42+
43+
- name: Composer Install
44+
uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # v3.1.1
45+
46+
- name: Check Syntax
47+
run: composer dev:lint:syntax
48+
49+
- name: Check Code Style
50+
run: composer dev:lint:style
51+
52+
static-analysis:
53+
name: Static Analysis
54+
runs-on: ubuntu-latest
55+
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2659
with:
27-
path: |
28-
vendor
29-
~/.composer/cache
30-
key: composer-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
31-
restore-keys: composer-${{ runner.os }}-
32-
- run: composer install --quiet --no-ansi --no-interaction --no-progress --prefer-dist
33-
- run: composer normalize --dry-run
34-
- run: composer validate
35-
- run: composer phpstan -- --ansi
36-
- run: composer psalm
60+
fetch-depth: 0
61+
show-progress: false
3762

38-
unit-tests:
39-
needs: [static-analysis]
63+
- name: Setup PHP
64+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
65+
with:
66+
php-version: 'latest'
67+
tools: composer
68+
coverage: none
69+
70+
- name: Composer Install
71+
uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # v3.1.1
72+
73+
- name: Run Static Analysis
74+
run: composer dev:analyze:phpstan
75+
76+
code-coverage:
77+
name: Code Coverage
78+
needs: [coding-standards, static-analysis]
4079
runs-on: ubuntu-latest
80+
4181
steps:
42-
- uses: actions/checkout@v6
82+
- name: Checkout
83+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
4384
with:
4485
fetch-depth: 0
4586
show-progress: false
46-
- uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1
87+
88+
- name: Setup PHP
89+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
4790
with:
48-
php-version: '8.4'
91+
php-version: 'latest'
4992
tools: composer
93+
extensions: gmp
5094
coverage: xdebug
51-
- uses: actions/cache@v4
52-
with:
53-
path: |
54-
vendor
55-
~/.composer/cache
56-
key: composer-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
57-
restore-keys: composer-${{ runner.os }}-
58-
- run: composer install --quiet --no-ansi --no-interaction --no-progress --prefer-dist
59-
- run: composer normalize --dry-run
60-
- run: composer validate
61-
- run: vendor/bin/phpunit || true
62-
- uses: SonarSource/sonarqube-scan-action@a31c9398be7ace6bbfaf30c0bd5d415f843d45e9
95+
96+
- name: Composer Install
97+
uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # v3.1.1
98+
99+
- name: Run Tests with Coverage
100+
run: composer dev:test:coverage:ci
101+
102+
- name: Upload to SonarCloud
103+
uses: SonarSource/sonarqube-scan-action@a31c9398be7ace6bbfaf30c0bd5d415f843d45e9 # 7.0.0
63104
env:
64-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
105+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
106+
107+
unit-tests:
108+
name: Unit Tests
109+
needs: [coding-standards, static-analysis]
110+
runs-on: ${{ matrix.os }}
111+
112+
strategy:
113+
fail-fast: false
114+
matrix:
115+
php-version: ['8.2', '8.3', '8.4', '8.5']
116+
os: [ubuntu-latest, windows-latest]
117+
118+
steps:
119+
- name: Configure Git for Windows
120+
if: ${{ matrix.os == 'windows-latest' }}
121+
run: |
122+
git config --system core.autocrlf false
123+
git config --system core.eol lf
124+
125+
- name: Checkout
126+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
127+
with:
128+
fetch-depth: 0
129+
show-progress: false
130+
131+
- name: Setup PHP
132+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
133+
with:
134+
php-version: ${{ matrix.php-version }}
135+
tools: composer
136+
extensions: gmp
137+
coverage: none
138+
139+
- name: Composer Install
140+
uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # v3.1.1
141+
142+
- name: Run Unit Tests
143+
run: composer dev:test:unit

.gitignore

Lines changed: 127 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,131 @@
1-
# PhpStorm
2-
/.idea/
1+
##### Operating Systems
32

4-
# Composer
5-
/vendor
3+
# macOS
4+
.DS_Store
5+
.AppleDouble
6+
.LSOverride
7+
._*
8+
.DocumentRevisions-V100
9+
.fseventsd
10+
.Spotlight-V100
11+
.TemporaryItems
12+
.Trashes
13+
.VolumeIcon.icns
14+
.com.apple.timemachine.donotpresent
15+
.AppleDB
16+
.AppleDesktop
17+
Network Trash Folder
18+
Temporary Items
19+
.apdisk
620

21+
# Linux
22+
*~
23+
.fuse_hidden*
24+
.directory
25+
.Trash-*
26+
.nfs*
27+
28+
# Windows
29+
Thumbs.db
30+
Thumbs.db:encryptable
31+
ehthumbs.db
32+
ehthumbs_vista.db
33+
*.stackdump
34+
[Dd]esktop.ini
35+
$RECYCLE.BIN/
36+
*.lnk
37+
38+
##### IDEs and Editors
39+
40+
# JetBrains (PhpStorm, IntelliJ, etc.)
41+
.idea/
42+
*.iws
43+
out/
44+
atlassian-ide-plugin.xml
45+
com_crashlytics_export_strings.xml
46+
crashlytics.properties
47+
crashlytics-build.properties
48+
fabric.properties
49+
50+
# Visual Studio Code
51+
.vscode/*
52+
!.vscode/settings.json
53+
!.vscode/tasks.json
54+
!.vscode/launch.json
55+
!.vscode/extensions.json
56+
*.code-workspace
57+
.history/
58+
59+
# Vim
60+
[._]*.s[a-v][a-z]
61+
!*.svg
62+
[._]*.sw[a-p]
63+
[._]s[a-rt-v][a-z]
64+
[._]ss[a-gi-z]
65+
[._]sw[a-p]
66+
Session.vim
67+
Sessionx.vim
68+
.netrwhist
69+
tags
70+
[._]*.un~
71+
72+
# Emacs
73+
*~
74+
\#*\#
75+
/.emacs.desktop
76+
/.emacs.desktop.lock
77+
*.elc
78+
auto-save-list
79+
tramp
80+
.\#*
81+
.org-id-locations
82+
*_archive
83+
84+
# Sublime Text
85+
*.tmlanguage.cache
86+
*.tmPreferences.cache
87+
*.stTheme.cache
88+
*.sublime-workspace
89+
sftp-config.json
90+
sftp-config-alt*.json
91+
92+
##### Backup Files
93+
*.bak
94+
*.gho
95+
*.ori
96+
*.orig
97+
*.tmp
98+
99+
##### Composer
100+
composer.phar
101+
/vendor/
102+
composer.lock
103+
104+
##### PHP Testing & Analysis
7105
# PHPUnit
8-
/.phpunit.cache
106+
.phpunit.cache/
9107
.phpunit.result.cache
108+
phpunit.xml
109+
110+
# Coverage Reports
111+
coverage/
112+
build/
113+
*.coverage
114+
clover.xml
115+
coverage.xml
116+
coverage.clover
117+
phpunit-coverage.xml
118+
119+
# PHPStan
120+
.phpstan.cache/
121+
.phpstan/
122+
phpstan.neon.dist
123+
124+
# PHP-CS-Fixer / CodeSniffer
125+
.php-cs-fixer.cache
126+
.php_cs.cache
127+
/wpcs/*
128+
129+
# Psalm
130+
.psalm/
131+
psalm.xml

0 commit comments

Comments
 (0)