mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-13 15:46:53 +03:00
ci: update CI workflows
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# GitHub Actions Documentation: https://docs.github.com/en/actions
|
# GitHub Actions Documentation: https://docs.github.com/en/actions
|
||||||
|
|
||||||
name: "build"
|
name: "Continuous Integration"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -25,6 +25,7 @@ jobs:
|
|||||||
coding-standards:
|
coding-standards:
|
||||||
name: "Coding standards"
|
name: "Coding standards"
|
||||||
runs-on: "ubuntu-latest"
|
runs-on: "ubuntu-latest"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout repository"
|
- name: "Checkout repository"
|
||||||
uses: "actions/checkout@v4"
|
uses: "actions/checkout@v4"
|
||||||
@@ -39,14 +40,15 @@ jobs:
|
|||||||
uses: "ramsey/composer-install@v3"
|
uses: "ramsey/composer-install@v3"
|
||||||
|
|
||||||
- name: "Check syntax (php-parallel-lint)"
|
- name: "Check syntax (php-parallel-lint)"
|
||||||
run: "composer lint -- --colors"
|
run: "composer dev:lint:syntax"
|
||||||
|
|
||||||
- name: "Check coding standards (PHP_CodeSniffer)"
|
- name: "Check coding standards (PHP_CodeSniffer)"
|
||||||
run: "./vendor/bin/phpcs --colors"
|
run: "composer dev:lint:style"
|
||||||
|
|
||||||
static-analysis:
|
static-analysis:
|
||||||
name: "Static analysis"
|
name: "Static analysis"
|
||||||
runs-on: "ubuntu-latest"
|
runs-on: "ubuntu-latest"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout repository"
|
- name: "Checkout repository"
|
||||||
uses: "actions/checkout@v4"
|
uses: "actions/checkout@v4"
|
||||||
@@ -61,7 +63,7 @@ jobs:
|
|||||||
uses: "ramsey/composer-install@v3"
|
uses: "ramsey/composer-install@v3"
|
||||||
|
|
||||||
- name: "Statically analyze code (PHPStan)"
|
- name: "Statically analyze code (PHPStan)"
|
||||||
run: "composer phpstan -- --ansi"
|
run: "composer dev:analyze:phpstan"
|
||||||
|
|
||||||
benchmark:
|
benchmark:
|
||||||
name: "Benchmark"
|
name: "Benchmark"
|
||||||
@@ -106,13 +108,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
dependency-versions: "${{ matrix.dependency-versions }}"
|
dependency-versions: "${{ matrix.dependency-versions }}"
|
||||||
|
|
||||||
- name: "Run PHPBench"
|
- name: "Run benchmarks (PHPBench)"
|
||||||
run: "composer phpbench -- --ansi"
|
run: "composer dev:bench"
|
||||||
|
|
||||||
code-coverage:
|
code-coverage:
|
||||||
name: "Code coverage"
|
name: "Code coverage"
|
||||||
needs: ["coding-standards", "static-analysis"]
|
needs: ["coding-standards", "static-analysis"]
|
||||||
runs-on: "ubuntu-latest"
|
runs-on: "ubuntu-latest"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout repository"
|
- name: "Checkout repository"
|
||||||
uses: "actions/checkout@v4"
|
uses: "actions/checkout@v4"
|
||||||
@@ -127,7 +130,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
php-version: "latest"
|
php-version: "latest"
|
||||||
extensions: bcmath, gmp, sodium, uuid
|
extensions: bcmath, gmp, sodium, uuid
|
||||||
coverage: "pcov"
|
coverage: "xdebug"
|
||||||
ini-values: "memory_limit=-1"
|
ini-values: "memory_limit=-1"
|
||||||
|
|
||||||
- name: "Install dependencies (Composer)"
|
- name: "Install dependencies (Composer)"
|
||||||
@@ -136,10 +139,17 @@ jobs:
|
|||||||
dependency-versions: "${{ matrix.dependencies }}"
|
dependency-versions: "${{ matrix.dependencies }}"
|
||||||
|
|
||||||
- name: "Run unit tests (PHPUnit)"
|
- name: "Run unit tests (PHPUnit)"
|
||||||
run: "./vendor/bin/phpunit --verbose --colors=always --coverage-text --coverage-clover build/logs/clover.xml"
|
run: "composer dev:test:coverage:ci"
|
||||||
|
|
||||||
- name: "Publish coverage report to Codecov"
|
- name: "Publish coverage report to Codecov"
|
||||||
uses: "codecov/codecov-action@v5.0.2"
|
uses: "codecov/codecov-action@v5"
|
||||||
|
|
||||||
|
- name: "Upload test results to Codecov"
|
||||||
|
if: ${{ !cancelled() }}
|
||||||
|
uses: "codecov/test-results-action@v1"
|
||||||
|
with:
|
||||||
|
disable_search: true
|
||||||
|
file: "./build/junit.xml"
|
||||||
|
|
||||||
unit-tests:
|
unit-tests:
|
||||||
name: "Unit Tests"
|
name: "Unit Tests"
|
||||||
@@ -195,4 +205,4 @@ jobs:
|
|||||||
dependency-versions: "${{ matrix.dependency-versions }}"
|
dependency-versions: "${{ matrix.dependency-versions }}"
|
||||||
|
|
||||||
- name: "Run unit tests (PHPUnit)"
|
- name: "Run unit tests (PHPUnit)"
|
||||||
run: "./vendor/bin/phpunit --verbose --colors=always --no-coverage"
|
run: "composer dev:test:unit"
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
# See https://github.com/ridedott/merge-me-action/
|
|
||||||
# This workflow automates merges from patches sent by Dependabot, and
|
|
||||||
# only by dependabot, once the other CI workflows pass
|
|
||||||
name: Auto-merge Dependabot PRs
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_run:
|
|
||||||
types:
|
|
||||||
- completed
|
|
||||||
workflows:
|
|
||||||
- "build"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
merge-me:
|
|
||||||
name: Auto-merge Dependabot PRs
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Auto-Merge
|
|
||||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
||||||
uses: ridedott/merge-me-action@v2.10.111
|
|
||||||
with:
|
|
||||||
# This must be used as GitHub Actions token does not support pushing
|
|
||||||
# to protected branches.
|
|
||||||
GITHUB_TOKEN: ${{ secrets.MERGE_TOKEN }}
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# Merge Me! Documentation: https://github.com/ridedott/merge-me-action/
|
||||||
|
|
||||||
|
name: "Merge Dependabot PRs"
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
types:
|
||||||
|
- "completed"
|
||||||
|
workflows:
|
||||||
|
- "Continuous Integration"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
merge-me:
|
||||||
|
name: "Merge me!"
|
||||||
|
runs-on: "ubuntu-latest"
|
||||||
|
steps:
|
||||||
|
- name: "Auto-merge"
|
||||||
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||||
|
uses: "ridedott/merge-me-action@v2"
|
||||||
|
with:
|
||||||
|
# This must be used as the GitHub Actions token does not support pushing
|
||||||
|
# to protected branches.
|
||||||
|
#
|
||||||
|
# Create a token with repository permissions:
|
||||||
|
# https://github.com/settings/tokens/new?scopes=repo&description=Merge+Me!+GitHub+Actions+Workflow
|
||||||
|
#
|
||||||
|
# Set MERGE_TOKEN as an environment variable on your repository:
|
||||||
|
# https://github.com/yourname/repo-name/settings/secrets/actions/new
|
||||||
|
GITHUB_TOKEN: ${{ secrets.MERGE_TOKEN }}
|
||||||
+6
-6
@@ -85,7 +85,7 @@ When you do begin working on your feature, here are some guidelines to consider:
|
|||||||
|
|
||||||
## Developing
|
## Developing
|
||||||
|
|
||||||
To develop this project, you will need [PHP](https://www.php.net) 7.4 or greater
|
To develop this project, you will need [PHP](https://www.php.net) 8.0 or greater
|
||||||
and [Composer](https://getcomposer.org).
|
and [Composer](https://getcomposer.org).
|
||||||
|
|
||||||
After cloning this repository locally, execute the following commands:
|
After cloning this repository locally, execute the following commands:
|
||||||
@@ -99,7 +99,7 @@ Now, you are ready to develop!
|
|||||||
|
|
||||||
### Tooling
|
### Tooling
|
||||||
|
|
||||||
This project uses [CaptainHook](https://github.com/CaptainHookPhp/captainhook)
|
This project uses [CaptainHook](https://github.com/captainhook-git/captainhook)
|
||||||
to validate all staged changes prior to commit.
|
to validate all staged changes prior to commit.
|
||||||
|
|
||||||
### Commands
|
### Commands
|
||||||
@@ -113,7 +113,7 @@ composer list
|
|||||||
### Coding Standards
|
### Coding Standards
|
||||||
|
|
||||||
This project follows a superset of [PSR-12](https://www.php-fig.org/psr/psr-12/)
|
This project follows a superset of [PSR-12](https://www.php-fig.org/psr/psr-12/)
|
||||||
coding standards, enforced by [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
|
coding standards, enforced by [PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer).
|
||||||
|
|
||||||
CaptainHook will run coding standards checks before committing.
|
CaptainHook will run coding standards checks before committing.
|
||||||
|
|
||||||
@@ -121,10 +121,10 @@ You may lint the codebase manually using the following commands:
|
|||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
# Lint
|
# Lint
|
||||||
composer phpcs
|
composer dev:lint
|
||||||
|
|
||||||
# Attempt to auto-fix coding standards issues
|
# Attempt to auto-fix coding standards issues
|
||||||
composer phpcbf
|
composer dev:lint:fix
|
||||||
```
|
```
|
||||||
|
|
||||||
### Static Analysis
|
### Static Analysis
|
||||||
@@ -139,7 +139,7 @@ following command:
|
|||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
# Static analysis
|
# Static analysis
|
||||||
composer analyze
|
composer dev:analyze
|
||||||
```
|
```
|
||||||
|
|
||||||
### Project Structure
|
### Project Structure
|
||||||
|
|||||||
+36
-17
@@ -75,22 +75,41 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"analyze": "@phpstan",
|
"dev:analyze": "@dev:analyze:phpstan",
|
||||||
"build:clean": "git clean -fX build/",
|
"dev:analyze:phpstan": "phpstan analyse --ansi --memory-limit 1G",
|
||||||
"lint": "parallel-lint src tests",
|
"dev:bench": "phpbench run",
|
||||||
"lint:paths": "parallel-lint",
|
"dev:build:clean": "git clean -fX build/",
|
||||||
"phpbench": "phpbench run",
|
"dev:lint": [
|
||||||
"phpcbf": "phpcbf -vpw --cache=build/cache/phpcs.cache",
|
"@dev:lint:syntax",
|
||||||
"phpcs": "phpcs --cache=build/cache/phpcs.cache",
|
"@dev:lint:style"
|
||||||
"phpstan": "phpstan analyse --memory-limit=1G",
|
],
|
||||||
"phpunit": "phpunit --verbose --colors=always",
|
"dev:lint:fix": "phpcbf --cache=build/cache/phpcs.cache",
|
||||||
"phpunit-coverage": "phpunit --verbose --colors=always --coverage-html build/coverage",
|
"dev:lint:style": "phpcs --cache=build/cache/phpcs.cache --colors",
|
||||||
"test": [
|
"dev:lint:syntax": "parallel-lint --colors src/ tests/",
|
||||||
"@lint",
|
"dev:test": [
|
||||||
"@phpbench",
|
"@dev:lint",
|
||||||
"@phpcs",
|
"@dev:bench",
|
||||||
"@phpstan",
|
"@dev:analyze",
|
||||||
"@phpunit"
|
"@dev:test:unit"
|
||||||
]
|
],
|
||||||
|
"dev:test:coverage:ci": "@php -d 'xdebug.mode=coverage' vendor/bin/phpunit --colors=always --coverage-text --coverage-clover build/coverage/clover.xml --coverage-cobertura build/coverage/cobertura.xml --coverage-crap4j build/coverage/crap4j.xml --coverage-xml build/coverage/coverage-xml --log-junit build/junit.xml",
|
||||||
|
"dev:test:coverage:html": "@php -d 'xdebug.mode=coverage' vendor/bin/phpunit --colors=always --coverage-html build/coverage/coverage-html/",
|
||||||
|
"dev:test:unit": "phpunit --colors=always",
|
||||||
|
"test": "@dev:test"
|
||||||
|
},
|
||||||
|
"scripts-descriptions": {
|
||||||
|
"dev:analyze": "Runs all static analysis checks.",
|
||||||
|
"dev:analyze:phpstan": "Runs the PHPStan static analyzer.",
|
||||||
|
"dev:bench": "Runs PHPBench benchmark tests.",
|
||||||
|
"dev:build:clean": "Cleans the build/ directory.",
|
||||||
|
"dev:lint": "Runs all linting checks.",
|
||||||
|
"dev:lint:fix": "Auto-fixes coding standards issues, if possible.",
|
||||||
|
"dev:lint:style": "Checks for coding standards issues.",
|
||||||
|
"dev:lint:syntax": "Checks for syntax errors.",
|
||||||
|
"dev:test": "Runs linting, static analysis, and unit tests.",
|
||||||
|
"dev:test:coverage:ci": "Runs unit tests and generates CI coverage reports.",
|
||||||
|
"dev:test:coverage:html": "Runs unit tests and generates HTML coverage report.",
|
||||||
|
"dev:test:unit": "Runs unit tests.",
|
||||||
|
"test": "Runs linting, static analysis, and unit tests."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user