mirror of
https://github.com/Respect/Validation.git
synced 2026-03-14 14:25:45 +01:00
Refactor CI Workflows
- Added a composite action for common setup tasks. - Shorter names that fit better GitHub runner displays. - Changed ci-perf to only run if src or tests change. - Removed redundant step names when they're obvious.
This commit is contained in:
parent
2a7f345e32
commit
b69beb1db7
9 changed files with 146 additions and 174 deletions
45
.github/actions/setup-action/action.yml
vendored
Normal file
45
.github/actions/setup-action/action.yml
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
name: 'Setup'
|
||||
description: 'Sets up the environment for Respect\Validation workflows.'
|
||||
|
||||
inputs:
|
||||
php-version:
|
||||
description: 'The PHP version to install.'
|
||||
required: false
|
||||
default: '8.5'
|
||||
coverage:
|
||||
description: 'PHP Coverage mode.'
|
||||
required: false
|
||||
default: 'none'
|
||||
extensions:
|
||||
description: 'Comma-separated list of PHP extensions to install.'
|
||||
required: false
|
||||
default: ''
|
||||
python-version:
|
||||
description: 'The Python version to install.'
|
||||
required: false
|
||||
python-deps:
|
||||
description: 'Space-separated list of Python packages to install.'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ inputs.php-version }}
|
||||
coverage: ${{ inputs.coverage }}
|
||||
extensions: ${{ inputs.extensions }}
|
||||
|
||||
- if: ${{ inputs.python-version != '' }}
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- if: ${{ inputs.python-deps != '' }}
|
||||
run: pip install ${{ inputs.python-deps }}
|
||||
shell: bash
|
||||
|
||||
- run: composer install --prefer-dist
|
||||
shell: bash
|
||||
59
.github/workflows/ci-code.yml
vendored
Normal file
59
.github/workflows/ci-code.yml
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
name: CI - Code
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'bin/**'
|
||||
- 'docs/**'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'bin/**'
|
||||
- 'docs/**'
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: Tests
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
php-version: ["8.5"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: ./.github/actions/setup-action
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
|
||||
- run: composer phpunit
|
||||
- run: composer pest
|
||||
|
||||
code-coverage:
|
||||
name: Code Coverage
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: ./.github/actions/setup-action
|
||||
with:
|
||||
coverage: pcov
|
||||
|
||||
- name: Generating Code Coverage Report
|
||||
run: ./vendor/bin/pest --compact --coverage-clover=coverage.xml
|
||||
|
||||
- name: Send Code Coverage Report to Codecov.io
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
static-analysis:
|
||||
name: Static Analysis
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: ./.github/actions/setup-action
|
||||
|
||||
- run: composer phpcs
|
||||
- run: composer phpstan
|
||||
- run: bin/console lint:mixin
|
||||
22
.github/workflows/ci-docs.yml
vendored
Normal file
22
.github/workflows/ci-docs.yml
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
name: CI - Docs
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'data/**'
|
||||
- 'tests/**'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'data/**'
|
||||
- 'tests/**'
|
||||
|
||||
jobs:
|
||||
docs:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: ./.github/actions/setup-action
|
||||
|
||||
- run: bin/console lint:docs
|
||||
|
|
@ -1,14 +1,16 @@
|
|||
name: Continuous Integration (perf)
|
||||
name: CI - Perf
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'bin/**'
|
||||
- 'docs/**'
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'tests/**'
|
||||
- '.github/**'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'bin/**'
|
||||
- 'docs/**'
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'tests/**'
|
||||
- '.github/**'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
baseline:
|
||||
|
|
@ -23,31 +25,20 @@ jobs:
|
|||
tests:
|
||||
name: Benchmarks
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
continue-on-error: true # This job is experimental
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
php-version:
|
||||
- "8.5"
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
persist-credentials: true
|
||||
|
||||
- name: Install PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
- uses: ./.github/actions/setup-action
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
extensions: xdebug
|
||||
|
||||
- name: Install Dependencies
|
||||
run: composer install --prefer-dist ${{ matrix.composer-extra-arguments }}
|
||||
|
||||
- name: Fetch Benchmarks
|
||||
run: |
|
||||
git fetch origin benchmarks
|
||||
|
|
@ -75,7 +66,7 @@ jobs:
|
|||
|
||||
cat report.md
|
||||
|
||||
- name: Commit Benchmark Results
|
||||
- name: Commit Results
|
||||
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
name: Continuous Integration (code)
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'bin/**'
|
||||
- 'docs/**'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'bin/**'
|
||||
- 'docs/**'
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: Tests
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
php-version:
|
||||
- "8.5"
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
coverage: none
|
||||
|
||||
- name: Install Dependencies
|
||||
run: composer install --prefer-dist ${{ matrix.composer-extra-arguments }}
|
||||
|
||||
- name: Run Unit Tests
|
||||
run: ./vendor/bin/phpunit --testsuite=unit
|
||||
|
||||
- name: Run Integration Tests
|
||||
run: ./vendor/bin/pest --testsuite=feature --compact
|
||||
|
||||
code-coverage:
|
||||
name: Code coverage
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.5
|
||||
coverage: pcov
|
||||
|
||||
- name: Install Dependencies
|
||||
run: composer install --prefer-dist ${{ matrix.composer-extra-arguments }}
|
||||
|
||||
- name: Generating Code Coverage Report
|
||||
run: ./vendor/bin/pest --compact --coverage-clover=coverage.xml
|
||||
|
||||
- name: Send Code Coverage Report to Codecov.io
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
static-analysis:
|
||||
name: Static Analysis
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.5
|
||||
coverage: none
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist
|
||||
|
||||
- name: Run PHP_CodeSniffer
|
||||
run: vendor/bin/phpcs
|
||||
|
||||
- name: Run PHPStan
|
||||
run: vendor/bin/phpstan analyze
|
||||
|
||||
- name: Run Validator's mixin linter
|
||||
run: bin/console lint:mixin
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
name: Continuous Integration (docs)
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'data/**'
|
||||
- 'tests/**'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'data/**'
|
||||
- 'tests/**'
|
||||
|
||||
jobs:
|
||||
docs:
|
||||
name: Documentation
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.5
|
||||
coverage: none
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist
|
||||
|
||||
- name: Lint documentation files
|
||||
run: bin/console lint:docs
|
||||
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
|
|
@ -6,8 +6,7 @@ jobs:
|
|||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v6
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: github.ref_type == 'tag'
|
||||
27
.github/workflows/reuse.yml
vendored
27
.github/workflows/reuse.yml
vendored
|
|
@ -13,28 +13,11 @@ jobs:
|
|||
name: Compliance Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
- uses: actions/checkout@v6
|
||||
- uses: ./.github/actions/setup-action
|
||||
with:
|
||||
python-version: '3.x'
|
||||
python-deps: reuse
|
||||
|
||||
- name: Install PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.5
|
||||
coverage: none
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist
|
||||
|
||||
- name: Install REUSE tool
|
||||
run: pip install reuse
|
||||
|
||||
- name: Run REUSE check
|
||||
run: reuse lint
|
||||
|
||||
- name: Run SPDX conventions check
|
||||
run: bin/console lint:spdx
|
||||
- run: reuse lint
|
||||
- run: bin/console lint:spdx
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
version = 1
|
||||
|
||||
[[annotations]]
|
||||
path = [ "*.yml", "*.yaml", ".git*", "*.dist", "docs/.pages", "docs/validators/.pages", "composer.json", "tests/fixtures/*", ".github/*.yml", ".github/workflows/**.yml", ".github/PULL_REQUEST_TEMPLATE.md", ".github/ISSUE_TEMPLATE/**" ]
|
||||
path = [ "*.yml", "*.yaml", ".git*", "*.dist", "docs/.pages", "docs/validators/.pages", "composer.json", "tests/fixtures/*", ".github/*.yml", ".github/actions/**.yml", ".github/workflows/**.yml", ".github/PULL_REQUEST_TEMPLATE.md", ".github/ISSUE_TEMPLATE/**" ]
|
||||
SPDX-FileCopyrightText = "Respect Project Contributors"
|
||||
SPDX-License-Identifier = "MIT"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue