mirror of
https://github.com/predis/predis.git
synced 2026-10-08 12:57:14 +00:00
Add complete CI (#1036)
* Add complete CI * Fix CI * Fix spelling * Fix indentation * Fix CI * Fix CI * Revert disabling unit tests * Add coverage driver to CI * Start coverage debugging * Fix debugging ignored, and an empty message aborts the commit. * Stop debugging * Move TODO-s from source to GitHub issues * Ignore too long lines in certain files * Revert requiring php-parallel-lint/php-parallel-lint * formatting * try shorter formatting * formatting * fix syntax * try two paths? * Update .editorconfig Co-authored-by: Viktor Szépe <viktor@szepe.net> * indentation * make it a group Co-authored-by: Till Krüss <tillkruss@users.noreply.github.com>
This commit is contained in:
@@ -1,61 +0,0 @@
|
||||
name: Linters
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v2.**
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
|
||||
php-cs-fixer:
|
||||
name: PHP CS Fixer
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PHP with Composer and extensions
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.1
|
||||
tools: php-cs-fixer
|
||||
|
||||
- name: Run php-cs-fixer
|
||||
run: php-cs-fixer fix --diff --dry-run --allow-risky=yes --using-cache=no
|
||||
|
||||
phpstan:
|
||||
name: PHPStan
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PHP with Composer and extensions
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.2
|
||||
tools: phpstan
|
||||
coverage: none
|
||||
|
||||
- name: Get Composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache Composer dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.directory }}
|
||||
key: tests-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: tests-php-${{ matrix.php }}-composer
|
||||
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --ansi --no-progress --prefer-dist ${{ matrix.php == '8.0' && '--ignore-platform-reqs' || '' }}
|
||||
|
||||
- name: Run PHPStan
|
||||
run: phpstan analyse
|
||||
@@ -0,0 +1,164 @@
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
|
||||
|
||||
name: Linters
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v2.**
|
||||
pull_request: null
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
|
||||
byte_level:
|
||||
name: Byte-level
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Check file permissions
|
||||
run: test "$(find . -type f -not -path './.git/*' -executable)" = "./bin/create-command-test"
|
||||
|
||||
- name: "Find non-printable ASCII characters"
|
||||
run: |
|
||||
! LC_ALL=C.UTF-8 find . -type f -name '*.php' -print0 \
|
||||
| xargs --null -- grep --perl-regexp --with-filename --line-number '[^ -~ü]'
|
||||
|
||||
syntax_errors:
|
||||
name: Syntax errors
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "8.1"
|
||||
coverage: none
|
||||
tools: parallel-lint
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Check source code for syntax errors
|
||||
run: composer exec -- parallel-lint bin/ examples/ src/ tests/
|
||||
|
||||
static_analysis:
|
||||
name: Static Analysis
|
||||
needs:
|
||||
- byte_level
|
||||
- syntax_errors
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "8.2"
|
||||
coverage: none
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Validate Composer configuration
|
||||
run: composer validate --no-interaction --strict
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ramsey/composer-install@v2
|
||||
with:
|
||||
dependency-versions: highest
|
||||
|
||||
- name: Check PSR-4 mapping
|
||||
run: composer dump-autoload --no-interaction --optimize --strict-psr
|
||||
|
||||
- name: Perform static analysis
|
||||
run: composer run phpstan
|
||||
|
||||
coding_standards:
|
||||
name: Coding Standards
|
||||
needs:
|
||||
- byte_level
|
||||
- syntax_errors
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "8.1"
|
||||
coverage: none
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Check EditorConfig configuration
|
||||
run: test -f .editorconfig
|
||||
|
||||
- name: Check adherence to EditorConfig
|
||||
uses: greut/eclint-action@v0
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ramsey/composer-install@v2
|
||||
with:
|
||||
dependency-versions: highest
|
||||
|
||||
- name: Check coding style
|
||||
run: composer exec -- php-cs-fixer fix --diff --dry-run --allow-risky=yes --using-cache=no
|
||||
|
||||
- name: Search for TODO-s and FIXME-s
|
||||
run: |
|
||||
! git grep --extended-regexp --ignore-case '\b(TODO|FIXME)\b' -- ':/' ':!tests/*' ':!*/linters\.yml'
|
||||
|
||||
exported_files:
|
||||
name: Exported files
|
||||
needs:
|
||||
- byte_level
|
||||
- syntax_errors
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Check exported files
|
||||
run: |
|
||||
EXPECTED="LICENSE,README.md,autoload.php,composer.json"
|
||||
CURRENT="$(
|
||||
git archive HEAD \
|
||||
| tar --list --exclude="src" --exclude="src/*" --exclude="bin" --exclude="bin/*" \
|
||||
| paste --serial --delimiters=","
|
||||
)"
|
||||
echo "CURRENT =${CURRENT}"
|
||||
echo "EXPECTED=${EXPECTED}"
|
||||
test "${CURRENT}" = "${EXPECTED}"
|
||||
|
||||
spelling:
|
||||
name: Spelling
|
||||
needs:
|
||||
- byte_level
|
||||
- syntax_errors
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache pip
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-codespell
|
||||
|
||||
- name: Install codespell
|
||||
run: pip install --user 'codespell>=2.2'
|
||||
|
||||
- name: Search for misspellings
|
||||
run: $(python -m site --user-base)/bin/codespell
|
||||
@@ -5,6 +5,10 @@ on:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
|
||||
update_release_draft:
|
||||
@@ -16,6 +20,6 @@ jobs:
|
||||
|
||||
- uses: release-drafter/release-drafter@v5
|
||||
with:
|
||||
config-name: release-drafter-config.yml
|
||||
config-name: release-drafter-config.yml
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
+31
-23
@@ -7,10 +7,14 @@ on:
|
||||
- v2.**
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
|
||||
predis:
|
||||
name: PHP ${{ matrix.php }} (Redis ${{ matrix.redis }})
|
||||
name: PHP ${{ matrix.php }} Redis ${{ matrix.redis }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
@@ -24,11 +28,11 @@ jobs:
|
||||
- '8.1'
|
||||
- '8.2'
|
||||
redis:
|
||||
- 3
|
||||
- 4
|
||||
- 5
|
||||
- 6
|
||||
- 7
|
||||
- '3'
|
||||
- '4'
|
||||
- '5'
|
||||
- '6'
|
||||
- '7'
|
||||
|
||||
services:
|
||||
redis:
|
||||
@@ -39,29 +43,33 @@ jobs:
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PHP with Composer and extensions
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
uses: shivammathur/setup-php@v2
|
||||
|
||||
- name: Get Composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache Composer dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.directory }}
|
||||
key: tests-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: tests-php-${{ matrix.php }}-composer
|
||||
coverage: ${{ (matrix.php == '8.1' && matrix.redis == '7') && 'xdebug' || 'none' }}
|
||||
|
||||
- name: Install Composer dependencies
|
||||
env:
|
||||
PHP_VERSION: ${{ matrix.php }}
|
||||
run: composer install --ansi --no-progress --prefer-dist $(if [ "$PHP_VERSION" == "8.0" ]; then echo "--ignore-platform-reqs"; fi;)
|
||||
uses: ramsey/composer-install@v2
|
||||
with:
|
||||
dependency-versions: highest
|
||||
composer-options: ${{ matrix.php == '8.0' && '--ignore-platform-reqs' || '' }}
|
||||
|
||||
- name: Run PHPUnit tests
|
||||
run: vendor/bin/phpunit
|
||||
if: ${{ matrix.php != '8.1' || matrix.redis != '7' }}
|
||||
run: vendor/bin/phpunit --verbose
|
||||
|
||||
- name: Run PHPUnit tests with coverage
|
||||
if: ${{ matrix.php == '8.1' && matrix.redis == '7' }}
|
||||
run: vendor/bin/phpunit --verbose --coverage-clover build/logs/clover.xml --coverage-filter src
|
||||
|
||||
- name: Send coverage to Coveralls
|
||||
env:
|
||||
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
if: ${{ env.COVERALLS_REPO_TOKEN && matrix.php == '8.1' && matrix.redis == '7' }}
|
||||
run: |
|
||||
wget "https://github.com/php-coveralls/php-coveralls/releases/download/v2.5.3/php-coveralls.phar"
|
||||
php ./php-coveralls.phar -v
|
||||
|
||||
Reference in New Issue
Block a user