Skip to content

Commit fff6839

Browse files
authored
Merge pull request #66 from PHPCSStandards/feature/ghactions-split-workflow
GH Actions: split workflow
2 parents 3e68131 + 59a9bd7 commit fff6839

File tree

3 files changed

+65
-46
lines changed

3 files changed

+65
-46
lines changed

.github/workflows/ci-cron.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: CI Cronjob
2+
3+
on:
4+
# Run this workflow on day 10 of every month as the repo isn't that active.
5+
schedule:
6+
- cron: '0 0 10 * *'
7+
8+
permissions: {}
9+
10+
jobs:
11+
QA:
12+
# Don't run the cron job on forks.
13+
if: ${{ github.event.repository.fork == false }}
14+
15+
uses: ./.github/workflows/reusable-qa-checks.yml

.github/workflows/ci.yml

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,14 @@
11
name: CI
22

33
on:
4-
# Run on all pushes and pull requests.
4+
# Run on pushes to `main` and on all pull requests.
55
push:
66
branches:
77
- main
88
pull_request:
9-
# Also run this workflow on day 10 of every month as the repo isn't that active.
10-
schedule:
11-
- cron: '0 0 10 * *'
129
# Allow manually triggering the workflow.
1310
workflow_dispatch:
1411

1512
jobs:
16-
xmllint:
17-
# Don't run the cron job on forks.
18-
if: ${{ github.event_name != 'schedule' || github.event.repository.fork == false }}
19-
20-
name: 'Check install and XML'
21-
runs-on: ubuntu-latest
22-
23-
env:
24-
XMLLINT_INDENT: ' '
25-
26-
steps:
27-
- name: Checkout code
28-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
29-
with:
30-
persist-credentials: false
31-
32-
- name: Install PHP
33-
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # 2.35.5
34-
with:
35-
php-version: 'latest'
36-
coverage: none
37-
38-
# Install dependencies to make sure the PHPCS XSD file is available.
39-
- name: Install dependencies
40-
run: composer install --prefer-dist --no-interaction --no-progress
41-
42-
# Validate the composer.json file.
43-
# @link https://getcomposer.org/doc/03-cli.md#validate
44-
- name: Validate Composer installation
45-
run: composer validate --no-check-all --strict
46-
47-
# Validate the xml file.
48-
- name: Validate against schema
49-
uses: phpcsstandards/xmllint-validate@0fd9c4a9046055f621fca4bbdccb8eab1fd59fdc # v1.0.1
50-
with:
51-
pattern: "PHPCSDev/ruleset.xml"
52-
xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd"
53-
54-
# Check the code-style consistency of the xml file.
55-
# Note: this needs xmllint, but that will be installed via the phpcsstandards/xmllint-validate action runner.
56-
- name: Check code style
57-
run: diff -B ./PHPCSDev/ruleset.xml <(xmllint --format "./PHPCSDev/ruleset.xml")
13+
QA:
14+
uses: ./.github/workflows/reusable-qa-checks.yml
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CI
2+
3+
on:
4+
workflow_call:
5+
6+
permissions: {}
7+
8+
jobs:
9+
xmllint:
10+
name: 'Check install and XML'
11+
runs-on: ubuntu-latest
12+
13+
env:
14+
XMLLINT_INDENT: ' '
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
19+
with:
20+
persist-credentials: false
21+
22+
- name: Install PHP
23+
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # 2.35.5
24+
with:
25+
php-version: 'latest'
26+
coverage: none
27+
28+
# Install dependencies to make sure the PHPCS XSD file is available.
29+
- name: Install dependencies
30+
run: composer install --prefer-dist --no-interaction --no-progress
31+
32+
# Validate the composer.json file.
33+
# @link https://getcomposer.org/doc/03-cli.md#validate
34+
- name: Validate Composer installation
35+
run: composer validate --no-check-all --strict
36+
37+
# Validate the xml file.
38+
- name: Validate against schema
39+
uses: phpcsstandards/xmllint-validate@0fd9c4a9046055f621fca4bbdccb8eab1fd59fdc # v1.0.1
40+
with:
41+
pattern: "PHPCSDev/ruleset.xml"
42+
xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd"
43+
44+
# Check the code-style consistency of the xml file.
45+
# Note: this needs xmllint, but that will be installed via the phpcsstandards/xmllint-validate action runner.
46+
- name: Check code style
47+
run: diff -B ./PHPCSDev/ruleset.xml <(xmllint --format "./PHPCSDev/ruleset.xml")

0 commit comments

Comments
 (0)