Skip to content

Commit d06016f

Browse files
authored
Merge pull request #524 from phpmetrics/php84-standalone
2 parents c43217c + f4d5d54 commit d06016f

File tree

149 files changed

+1350
-716
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+1350
-716
lines changed

.github/FUNDING.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: [Halleck45]

.github/workflows/ci.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
pull_request:
7+
branches: [ master, main ]
8+
release:
9+
types: [created]
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
php-version: [5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4]
17+
include:
18+
- php-version: nightly
19+
fail-fast: false
20+
21+
services:
22+
docker:
23+
image: docker:20.10.16
24+
options: --privileged
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Set up PHP ${{ matrix.php-version }}
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: ${{ matrix.php-version }}
33+
34+
- name: "Remove ': void' return type hint for older PHP versions"
35+
run: |
36+
# if php version < 7.1, remove ': void' return type hint
37+
if [[ "${{ matrix.php-version }}" < "7.1" ]]; then
38+
echo "Removing ': void' return type hint for PHP version ${{ matrix.php-version }}"
39+
# Find and replace ': void' in all PHP files
40+
find . -type f -name "*.php" -exec sed -i 's/: void//g' {} +
41+
fi
42+
43+
- name: Install Composer dependencies (${{ matrix.php-version }})
44+
run: composer install --no-interaction --prefer-dist --no-progress
45+
46+
- name: Run tests (${{ matrix.php-version }})
47+
run: make test
48+
49+
build:
50+
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/')
51+
needs: test
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Set up PHP
57+
uses: shivammathur/setup-php@v2
58+
with:
59+
php-version: 7.0
60+
61+
- name: Build project
62+
run: make build
63+
64+
- name: Add build artifact
65+
run: git add -f build/phpmetrics.phar
66+
67+
- name: Upload release asset
68+
uses: softprops/action-gh-release@v2
69+
with:
70+
files: build/phpmetrics.phar
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
composer.lock
22
vendor
3+
tooling/vendor
34
.idea
45
md5sums
56
control
@@ -8,3 +9,12 @@ build/phpmetrics.dsc
89
build/phpmetrics.deb
910
build/phpmetrics.tar.gz
1011
build/phpmetrics.changes
12+
.php-cs-fixer.cache
13+
.phpunit.result.cache
14+
15+
# build
16+
buildroot/
17+
downloads/
18+
pkgroot/
19+
source/
20+
spc

.php-cs-fixer.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
$finder = (new PhpCsFixer\Finder())
4+
->in(__DIR__ . '/src')
5+
;
6+
7+
return (new PhpCsFixer\Config())
8+
->setRules([
9+
'@PER-CS' => true,
10+
'@PHP82Migration' => true,
11+
])
12+
->setFinder($finder)
13+
->setUnsupportedPhpVersionAllowed(true)
14+
;

.travis.yml

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

Makefile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22

33
include artifacts/Makefile
44

5-
# Run unit tests
5+
# Run unit tests
66
test:
7-
./vendor/bin/phpunit -c phpunit.xml.dist
7+
./vendor/bin/phpunit -c phpunit.xml.dist --exclude-group binary
88

9-
# Codesniffer check
10-
phpcs:
11-
./vendor/bin/phpcs src/ tests/ --extensions=php -n
12-
13-
# Codesniffer fix
14-
phpcbf:
15-
./vendor/bin/phpcbf src/ tests/ --extensions=php -n
9+
# Compatibility check
10+
compatibility:
11+
(docker run --rm -v `pwd`:/www --workdir=/www php:5.6-cli find src -iname "*.php" -exec php -l {} \; |grep -v "Php7NodeTraverser.php" | grep -v "No syntax errors detected") && echo OK
1612

1713
# Used for tag releasing
1814
# Don't use directly, use `make release` instead

artifacts/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ BUILD_DIR=releases
44

55
include artifacts/phar/Makefile
66
include artifacts/debian/Makefile
7+
include artifacts/standalone/Makefile
78

89
prepare-build:
910
@# Disable the deletion of all releases packages as task build-debian is disabled.
@@ -12,5 +13,5 @@ prepare-build:
1213
@# Only remove the phar that must be replaced by the new release.
1314
@rm -f ${BUILD_DIR}/phpmetrics.phar
1415

15-
build: prepare-build build-phar build-deb
16+
build: prepare-build build-phar build-deb build-standalone
1617

artifacts/standalone/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
build-standalone: build-standalone-linux
2+
3+
build-standalone-linux:
4+
mkdir -p ${BUILD_DIR}
5+
curl -fsSL -o spc.tgz https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64.tar.gz && tar -zxvf spc.tgz && rm spc.tgz
6+
./spc download --with-php=8.4 --for-extensions "apcu,phar,curl,dom,fileinfo,filter,intl,mbstring,mysqlnd,openssl,tokenizer,zlib" --prefer-pre-built
7+
./spc install-pkg upx
8+
./spc build --build-micro "apcu,phar,curl,dom,fileinfo,filter,intl,mbstring,mysqlnd,openssl,tokenizer,zlib" --with-upx-pack
9+
./spc micro:combine ${BUILD_DIR}/phpmetrics.phar --output=${BUILD_DIR}/phpmetrics-linux-x86_64
10+

composer.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,23 @@
3030
},
3131
"files": ["./src/functions.php"]
3232
},
33+
"autoload-dev": {
34+
"psr-4": {
35+
"Test\\Hal\\": "tests/"
36+
}
37+
},
3338
"require": {
34-
"php": ">=5.5",
3539
"ext-dom": "*",
3640
"ext-tokenizer": "*",
37-
"nikic/php-parser": "^3|^4"
38-
},
39-
"require-dev": {
40-
"phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14",
41-
"sebastian/comparator": ">=1.2.3",
42-
"squizlabs/php_codesniffer": "^3.5",
43-
"symfony/dom-crawler": "^3.0 || ^4.0 || ^5.0"
41+
"nikic/php-parser": "^3|^4|^5"
4442
},
4543
"bin": [
4644
"bin/phpmetrics"
4745
],
4846
"config": {
4947
"sort-packages": true
48+
},
49+
"require-dev": {
50+
"phpunit/phpunit": "*"
5051
}
5152
}

craft.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
php-version: 8.4
2+
extensions: "apcu,phar,curl,dom,fileinfo,filter,intl,mbstring,mysqlnd,openssl,tokenizer,zlib"
3+
sapi: micro
4+
build-options:
5+
with-upx-pack: true
6+
prefer-pre-built: true

0 commit comments

Comments
 (0)