Skip to content

Commit

Permalink
Add an encoder and bump to PHP8.2 (#77)
Browse files Browse the repository at this point in the history
* Replace string with int normalization and update dependencies

Refactor tests and implementation to use integers for normalization instead of strings, including Unsigned and Signed Integer Tests and associated data providers. Migrate dependencies in composer.json and update various configurations for PHP 8.2 syntax support and PHPUnit 11.0.
  • Loading branch information
Spomky authored Oct 31, 2024
1 parent 658ed12 commit 79b84a4
Show file tree
Hide file tree
Showing 46 changed files with 794 additions and 329 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
/CODE_OF_CONDUCT.md export-ignore
/deptrac.yaml export-ignore
/ecs.php export-ignore
/castor.php export-ignore
/infection.json.dist export-ignore
/Makefile export-ignore
/phpstan.neon export-ignore
/phpstan-baseline.neon export-ignore
/phpunit.xml.dist export-ignore
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Dependency Review'
on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
34 changes: 34 additions & 0 deletions .github/workflows/infection.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Integrate"

on:
push:
branches:
- "*.*.x"

jobs:
mutation_testing:
name: "5️⃣ Mutation Testing"
runs-on: "ubuntu-latest"
steps:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.3"
extensions: "ctype, curl, dom, json, libxml, mbstring, openssl, phar, simplexml, sodium, tokenizer, xml, xmlwriter, zlib"
tools: "castor"
coverage: "xdebug"

- name: "Checkout code"
uses: "actions/checkout@v4"

- name: "Fetch Git base reference"
run: "git fetch --depth=1 origin ${GITHUB_BASE_REF}"

- name: "Install dependencies"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "highest"
composer-options: "--optimize-autoloader"

- name: "Execute Infection"
run: "castor infect"
48 changes: 11 additions & 37 deletions .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.3"
tools: "castor"
coverage: "none"

- name: "Checkout code"
Expand All @@ -43,7 +44,7 @@ jobs:
dependency-versions: "highest"

- name: "Check source code for syntax errors"
run: "composer exec -- parallel-lint src/ tests/"
run: "castor lint"

unit_tests:
name: "2️⃣ Unit and functional tests"
Expand All @@ -55,7 +56,6 @@ jobs:
operating-system:
- "ubuntu-latest"
php-version:
- "8.1"
- "8.2"
- "8.3"
dependencies:
Expand All @@ -67,6 +67,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
tools: "castor"
extensions: "ctype, dom, json, libxml, mbstring, openssl, phar, simplexml, tokenizer, xml, xmlwriter"
coverage: "xdebug"

Expand All @@ -80,7 +81,7 @@ jobs:
composer-options: "--optimize-autoloader"

- name: "Execute tests (PHP)"
run: "make ci-cc"
run: "castor test"

# - name: Send coverage to Coveralls
# if: "matrix.php-version == '8.1' && matrix.dependencies == 'highest'"
Expand All @@ -101,6 +102,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.3"
tools: "castor"
extensions: "ctype, dom, json, libxml, mbstring, openssl, phar, simplexml, tokenizer, xml, xmlwriter"
coverage: "none"

Expand All @@ -120,7 +122,7 @@ jobs:
run: "composer dump-autoload --optimize --strict-psr"

- name: "Execute static analysis"
run: "make st"
run: "castor stan"

coding_standards:
name: "4️⃣ Coding Standards"
Expand All @@ -133,6 +135,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.3"
tools: "castor"
extensions: "ctype, dom, json, libxml, mbstring, openssl, phar, simplexml, tokenizer, xml, xmlwriter"
coverage: "none"

Expand All @@ -146,40 +149,10 @@ jobs:
composer-options: "--optimize-autoloader"

- name: "Check coding style"
run: "make ci-cs"
run: "castor cs"

- name: "Deptrac"
run: |
vendor/bin/deptrac analyse --fail-on-uncovered --no-cache
mutation_testing:
name: "5️⃣ Mutation Testing"
needs:
- "byte_level"
- "syntax_errors"
runs-on: "ubuntu-latest"
steps:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.3"
extensions: "ctype, dom, json, libxml, mbstring, openssl, phar, simplexml, tokenizer, xml, xmlwriter"
coverage: "xdebug"

- name: "Checkout code"
uses: "actions/checkout@v3"

- name: "Fetch Git base reference"
run: "git fetch --depth=1 origin ${GITHUB_BASE_REF}"

- name: "Install dependencies"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "highest"
composer-options: "--optimize-autoloader"

- name: "Execute Infection"
run: "make ci-mu"
run: "castor deptrac"

rector_checkstyle:
name: "6️⃣ Rector Checkstyle"
Expand All @@ -192,6 +165,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.3"
tools: "castor"
extensions: "ctype, dom, json, libxml, mbstring, openssl, phar, simplexml, tokenizer, xml, xmlwriter"
coverage: "xdebug"

Expand All @@ -208,7 +182,7 @@ jobs:
composer-options: "--optimize-autoloader"

- name: "Execute Rector"
run: "make rector"
run: "castor rector"

exported_files:
name: "7️⃣ Exported files"
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/lock-closed-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'Lock Issues'

on:
schedule:
- cron: '12 6 * * *'

jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v5
with:
github-token: ${{ github.token }}
issue-inactive-days: '31'
exclude-issue-created-before: ''
exclude-any-issue-labels: ''
add-issue-labels: ''
issue-comment: >
This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.
issue-lock-reason: 'resolved'
process-only: 'issues'
28 changes: 0 additions & 28 deletions .github/workflows/merge-me.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/release-on-milestone-closed.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Automatic Releases"

on:
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Scorecards supply-chain security

on:
schedule:
- cron: '34 4 * * 6'
push:
branches:
- "*.*.x"

# Declare default permissions as read only.
permissions: read-all

jobs:
analysis:
name: Scorecards analysis
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
# Used to receive a badge. (Upcoming feature)
id-token: write
# Needs for private repositories.
contents: read
actions: read

steps:
- name: "Checkout code"
uses: actions/checkout@v4
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/[email protected]
with:
results_file: results.sarif
results_format: sarif
# (Optional) Read-only PAT token. Uncomment the `repo_token` line below if:
# - you want to enable the Branch-Protection check on a *public* repository, or
# - you are installing Scorecards on a *private* repository
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
# repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}

# Publish the results for public repositories to enable scorecard badges. For more details, see
# https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories, `publish_results` will automatically be set to `false`, regardless
# of the value entered here.
publish_results: true

# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/[email protected]
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ yarn-error.log
/composer.lock
/vendor
infection.txt
/.castor.stub.php
50 changes: 0 additions & 50 deletions Makefile

This file was deleted.

Loading

0 comments on commit 79b84a4

Please sign in to comment.