Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions .github/workflows/check-whitespace.yml

This file was deleted.

79 changes: 79 additions & 0 deletions .github/workflows/docbook-cs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: DocBook Lint

on:
push:
branches: [master]
Comment thread
jordikroon marked this conversation as resolved.
Outdated
pull_request:
branches: [master]

Comment thread
jordikroon marked this conversation as resolved.
jobs:
docbook-cs:
name: DocBook Style Check
runs-on: ubuntu-latest

steps:
- name: Checkout doc-en
uses: actions/checkout@v4
Comment thread
TimWolla marked this conversation as resolved.
Outdated
with:
ref: ${{ github.event.pull_request.head.sha }}
path: en
fetch-depth: 0
Comment thread
jordikroon marked this conversation as resolved.
Outdated

- name: Checkout php/doc-base
uses: actions/checkout@v4
with:
path: doc-base
repository: php/doc-base

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
extensions: dom, libxml, simplexml

- name: Build documentation
run: php doc-base/configure.php --disable-libxml-check --enable-xml-details --redirect-stderr-to-stdout --with-lang=en

- name: Install docbook-cs
working-directory: en
run: composer require jordikroon/docbook-cs
Comment thread
jordikroon marked this conversation as resolved.
Outdated

- name: Fetch base branch
working-directory: en
run: git fetch origin ${{ github.base_ref }}

- name: Run docbook-cs with diff
working-directory: en
run: |
set -o pipefail
git diff origin/${{ github.base_ref }}...HEAD | vendor/bin/docbook-cs \
--report=checkstyle \
--diff \
--no-colors > docbook-report.xml

- name: Upload report
if: always()
uses: actions/upload-artifact@v4
with:
name: docbook-report
path: en/docbook-report.xml

- name: Setup reviewdog
if: always()
Comment thread
jordikroon marked this conversation as resolved.
Outdated
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest

- name: Report violations via reviewdog
Comment thread
jordikroon marked this conversation as resolved.
Outdated
if: always()
working-directory: en
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat docbook-report.xml | reviewdog \
-f=checkstyle \
-name="docbook-cs" \
-reporter=github-pr-check \
-level=error \
-fail-level=any \
-filter-mode=nofilter
35 changes: 35 additions & 0 deletions docbookcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<docbookcs xmlns="https://docbookcs.org/config">
Comment thread
jordikroon marked this conversation as resolved.
Outdated

<project>
<directory alias="doc-en">en</directory>
<directory>doc-base</directory>
</project>

<sniffs>
<sniff class="DocbookCS\Sniff\SimparaSniff" />
<sniff class="DocbookCS\Sniff\ExceptionNameSniff" />
<sniff class="DocbookCS\Sniff\AttributeOrderSniff" />
<sniff class="DocbookCS\Sniff\WhitespaceSniff" />
</sniffs>

<paths>
<path>.</path>
</paths>

<entities>
<file>contributors.ent</file>
<file>extensions.ent</file>
<file>language-defs.ent</file>
<file>language-snippets.ent</file>
<directory>../doc-base/entities/</directory>
<file>../doc-base/temp/file-entities.ent</file>
<directory>../doc-base/temp/file-entities</directory>
</entities>

<exclude>
<pattern>*/wkhtmltox/bits/*</pattern>
<pattern>output/*</pattern>
</exclude>

</docbookcs>
Loading