Skip to content

Commit 36d731e

Browse files
authored
Merge pull request #624 from PHPCSStandards/feature/ghactions-use-reusable-workflows
GH Actions/PHPStan: use reusable workflow
2 parents 9168f53 + 0e834a5 commit 36d731e

File tree

2 files changed

+11
-108
lines changed

2 files changed

+11
-108
lines changed

.github/workflows/phpstan.yml

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,4 @@ concurrency:
2020
jobs:
2121
phpstan:
2222
name: "PHPStan"
23-
24-
runs-on: "ubuntu-latest"
25-
26-
steps:
27-
- name: Checkout code
28-
uses: actions/checkout@v4
29-
30-
- name: Install PHP
31-
uses: shivammathur/setup-php@v2
32-
with:
33-
php-version: 'latest'
34-
coverage: none
35-
tools: phpstan
36-
37-
# Install dependencies and handle caching in one go.
38-
# Dependencies need to be installed to make sure the PHPUnit classes are recognized.
39-
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
40-
- name: Install Composer dependencies
41-
uses: "ramsey/composer-install@v3"
42-
with:
43-
# Bust the cache at least once a month - output format: YYYY-MM.
44-
custom-cache-suffix: $(date -u "+%Y-%m")
45-
46-
- name: Run PHPStan
47-
run: phpstan analyse
23+
uses: PHPCSStandards/.github/.github/workflows/reusable-phpstan.yml@main

.github/workflows/validate.yml

Lines changed: 10 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ jobs:
2121
name: Check XML files
2222
runs-on: ubuntu-latest
2323

24+
# Don't run the cronjob in this workflow on forks.
25+
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'PHPCSStandards')
26+
2427
env:
2528
XMLLINT_INDENT: ' '
2629

@@ -71,99 +74,23 @@ jobs:
7174

7275
yamllint:
7376
name: 'Lint Yaml'
74-
runs-on: ubuntu-latest
75-
76-
steps:
77-
- name: Checkout code
78-
uses: actions/checkout@v4
79-
80-
- name: Run Yamllint on all yaml files in repo
81-
run: yamllint . --format colored --strict
77+
# Don't run the cronjob in this workflow on forks.
78+
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'PHPCSStandards')
8279

83-
- name: Pipe Yamllint results on to GH for inline display
84-
if: ${{ failure() }}
85-
run: yamllint . --format github --strict
80+
uses: PHPCSStandards/.github/.github/workflows/reusable-yamllint.yml@main
81+
with:
82+
strict: true
8683

8784
markdownlint:
8885
name: 'Lint Markdown'
89-
runs-on: ubuntu-latest
90-
9186
# Don't run the cronjob in this workflow on forks.
9287
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'PHPCSStandards')
9388

94-
steps:
95-
- name: Checkout code
96-
uses: actions/checkout@v4
97-
98-
# @link https://github.com/marketplace/actions/problem-matcher-for-markdownlint-cli
99-
- name: Enable showing issue in PRs
100-
uses: xt0rted/markdownlint-problem-matcher@v3
101-
102-
# @link https://github.com/marketplace/actions/markdownlint-cli2-action
103-
- name: Check markdown with CLI2
104-
uses: DavidAnson/markdownlint-cli2-action@v17
89+
uses: PHPCSStandards/.github/.github/workflows/reusable-markdownlint.yml@main
10590

10691
remark:
10792
name: 'QA Markdown'
108-
runs-on: ubuntu-latest
109-
11093
# Don't run the cronjob in this workflow on forks.
11194
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'PHPCSStandards')
11295

113-
steps:
114-
- name: Checkout code
115-
uses: actions/checkout@v4
116-
117-
- name: Set up node and enable caching of dependencies
118-
uses: actions/setup-node@v4
119-
with:
120-
node-version: "20"
121-
122-
# To make the command available on CLI, it needs to be installed globally.
123-
- name: Install Remark CLI globally
124-
run: npm install --global remark-cli --foreground-scripts true --fund false
125-
126-
# To allow for creating a custom config which references rules which are included
127-
# in the presets, without having to install all rules individually, a local install
128-
# works best (and installing the presets in the first place, of course).
129-
#
130-
# Note: the first group of packages are all part of the mono "Remark lint" repo.
131-
# The second group of packages (heading-whitespace and down) are additional
132-
# "external" rules/plugins.
133-
- name: Install Remark rules locally
134-
run: >
135-
npm install --foreground-scripts true --fund false
136-
remark-lint
137-
remark-gfm
138-
remark-preset-lint-consistent
139-
remark-preset-lint-recommended
140-
remark-preset-lint-markdown-style-guide
141-
remark-lint-checkbox-content-indent
142-
remark-lint-linebreak-style
143-
remark-lint-no-dead-urls
144-
remark-lint-no-duplicate-defined-urls
145-
remark-lint-no-empty-url
146-
remark-lint-no-heading-like-paragraph
147-
remark-lint-no-reference-like-url
148-
remark-lint-no-unneeded-full-reference-image
149-
remark-lint-no-unneeded-full-reference-link
150-
remark-lint-strikethrough-marker
151-
remark-lint-heading-whitespace
152-
remark-lint-list-item-punctuation
153-
remark-lint-match-punctuation
154-
remark-lint-no-hr-after-heading
155-
remark-lint-are-links-valid-duplicate
156-
remark-validate-links
157-
158-
- name: Run Remark-lint
159-
run: remark . --frail
160-
161-
# @link https://github.com/reviewdog/action-remark-lint
162-
- name: Show Remark-lint annotations in PR
163-
if: ${{ failure() && github.event_name == 'pull_request' }}
164-
uses: reviewdog/action-remark-lint@v5
165-
with:
166-
fail_on_error: true
167-
install_deps: false
168-
level: info
169-
reporter: github-pr-check
96+
uses: PHPCSStandards/.github/.github/workflows/reusable-remark.yml@main

0 commit comments

Comments
 (0)