Skip to content

Commit b69beb1

Browse files
committed
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.
1 parent 2a7f345 commit b69beb1

File tree

9 files changed

+146
-174
lines changed

9 files changed

+146
-174
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 'Setup'
2+
description: 'Sets up the environment for Respect\Validation workflows.'
3+
4+
inputs:
5+
php-version:
6+
description: 'The PHP version to install.'
7+
required: false
8+
default: '8.5'
9+
coverage:
10+
description: 'PHP Coverage mode.'
11+
required: false
12+
default: 'none'
13+
extensions:
14+
description: 'Comma-separated list of PHP extensions to install.'
15+
required: false
16+
default: ''
17+
python-version:
18+
description: 'The Python version to install.'
19+
required: false
20+
python-deps:
21+
description: 'Space-separated list of Python packages to install.'
22+
required: false
23+
default: ''
24+
25+
runs:
26+
using: 'composite'
27+
steps:
28+
29+
- uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: ${{ inputs.php-version }}
32+
coverage: ${{ inputs.coverage }}
33+
extensions: ${{ inputs.extensions }}
34+
35+
- if: ${{ inputs.python-version != '' }}
36+
uses: actions/setup-python@v6
37+
with:
38+
python-version: ${{ inputs.python-version }}
39+
40+
- if: ${{ inputs.python-deps != '' }}
41+
run: pip install ${{ inputs.python-deps }}
42+
shell: bash
43+
44+
- run: composer install --prefer-dist
45+
shell: bash

.github/workflows/ci-code.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CI - Code
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'bin/**'
7+
- 'docs/**'
8+
pull_request:
9+
paths-ignore:
10+
- 'bin/**'
11+
- 'docs/**'
12+
13+
jobs:
14+
tests:
15+
name: Tests
16+
runs-on: ubuntu-latest
17+
18+
strategy:
19+
matrix:
20+
php-version: ["8.5"]
21+
22+
steps:
23+
- uses: actions/checkout@v6
24+
- uses: ./.github/actions/setup-action
25+
with:
26+
php-version: ${{ matrix.php-version }}
27+
28+
- run: composer phpunit
29+
- run: composer pest
30+
31+
code-coverage:
32+
name: Code Coverage
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- uses: actions/checkout@v6
37+
- uses: ./.github/actions/setup-action
38+
with:
39+
coverage: pcov
40+
41+
- name: Generating Code Coverage Report
42+
run: ./vendor/bin/pest --compact --coverage-clover=coverage.xml
43+
44+
- name: Send Code Coverage Report to Codecov.io
45+
uses: codecov/codecov-action@v5
46+
with:
47+
token: ${{ secrets.CODECOV_TOKEN }}
48+
49+
static-analysis:
50+
name: Static Analysis
51+
runs-on: ubuntu-latest
52+
53+
steps:
54+
- uses: actions/checkout@v6
55+
- uses: ./.github/actions/setup-action
56+
57+
- run: composer phpcs
58+
- run: composer phpstan
59+
- run: bin/console lint:mixin

.github/workflows/ci-docs.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: CI - Docs
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'data/**'
7+
- 'tests/**'
8+
pull_request:
9+
paths-ignore:
10+
- 'data/**'
11+
- 'tests/**'
12+
13+
jobs:
14+
docs:
15+
name: Lint
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v6
20+
- uses: ./.github/actions/setup-action
21+
22+
- run: bin/console lint:docs

.github/workflows/continuous-integration-perf.yml renamed to .github/workflows/ci-perf.yml

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
name: Continuous Integration (perf)
1+
name: CI - Perf
22

33
on:
44
push:
5-
paths-ignore:
6-
- 'bin/**'
7-
- 'docs/**'
5+
paths:
6+
- 'src/**'
7+
- 'tests/**'
8+
- '.github/**'
89
pull_request:
9-
paths-ignore:
10-
- 'bin/**'
11-
- 'docs/**'
10+
paths:
11+
- 'src/**'
12+
- 'tests/**'
13+
- '.github/**'
1214
workflow_dispatch:
1315
inputs:
1416
baseline:
@@ -23,31 +25,20 @@ jobs:
2325
tests:
2426
name: Benchmarks
2527
runs-on: ubuntu-latest
28+
2629
continue-on-error: true # This job is experimental
2730
permissions:
2831
contents: write
2932
pull-requests: write
3033

31-
strategy:
32-
matrix:
33-
php-version:
34-
- "8.5"
35-
3634
steps:
37-
- name: Checkout
38-
uses: actions/checkout@v6
35+
- uses: actions/checkout@v6
3936
with:
4037
persist-credentials: true
41-
42-
- name: Install PHP
43-
uses: shivammathur/setup-php@v2
38+
- uses: ./.github/actions/setup-action
4439
with:
45-
php-version: ${{ matrix.php-version }}
4640
extensions: xdebug
4741

48-
- name: Install Dependencies
49-
run: composer install --prefer-dist ${{ matrix.composer-extra-arguments }}
50-
5142
- name: Fetch Benchmarks
5243
run: |
5344
git fetch origin benchmarks
@@ -75,7 +66,7 @@ jobs:
7566
7667
cat report.md
7768
78-
- name: Commit Benchmark Results
69+
- name: Commit Results
7970
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
8071
run: |
8172
set -euo pipefail

.github/workflows/continuous-integration-code.yml

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

.github/workflows/continuous-integration-docs.yml

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

.github/workflows/release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ jobs:
66
build:
77
runs-on: ubuntu-latest
88
steps:
9-
- name: Checkout
10-
uses: actions/checkout@v6
9+
- uses: actions/checkout@v6
1110
- name: Release
1211
uses: softprops/action-gh-release@v2
1312
if: github.ref_type == 'tag'

.github/workflows/reuse.yml

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,11 @@ jobs:
1313
name: Compliance Check
1414
runs-on: ubuntu-latest
1515
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v6
18-
19-
- name: Set up Python
20-
uses: actions/setup-python@v6
16+
- uses: actions/checkout@v6
17+
- uses: ./.github/actions/setup-action
2118
with:
2219
python-version: '3.x'
20+
python-deps: reuse
2321

24-
- name: Install PHP
25-
uses: shivammathur/setup-php@v2
26-
with:
27-
php-version: 8.5
28-
coverage: none
29-
30-
- name: Install dependencies
31-
run: composer install --prefer-dist
32-
33-
- name: Install REUSE tool
34-
run: pip install reuse
35-
36-
- name: Run REUSE check
37-
run: reuse lint
38-
39-
- name: Run SPDX conventions check
40-
run: bin/console lint:spdx
22+
- run: reuse lint
23+
- run: bin/console lint:spdx

REUSE.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version = 1
22

33
[[annotations]]
4-
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/**" ]
4+
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/**" ]
55
SPDX-FileCopyrightText = "Respect Project Contributors"
66
SPDX-License-Identifier = "MIT"

0 commit comments

Comments
 (0)