Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run full test diff for the latest CI Python version only #65

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
26 changes: 16 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
# Builds are failing with py3.9+ because sphinx templates are different.
# python: ['3.7', '3.8', '3.9', '3.10', '3.11']
python: ['3.7', '3.8']
python:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- 'latest' # hardcoded below as '3.11'
- 'beta' # hardcoded below as '3.12'
fail-fast: false

permissions:
Expand All @@ -23,7 +27,8 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
python-version: ${{ matrix.python == 'latest' && '3.11' || (matrix.python == 'beta' && '3.12' || matrix.python) }}
allow-prereleases: true

- name: Install tools
run: |
Expand All @@ -41,28 +46,29 @@ jobs:
cd test
find . -name '*.html' -exec rm {} \;

sed -i 's~, "log\.md"~~' conf.py
make html SPHINXOPTS='' 2>&1 | tee log.txt
sed -i 's~, "logging\.md"~~' conf.py
make html SPHINXOPTS='' 2>&1 | tee baseline.txt
git restore conf.py

(cd _build/html && rm genindex.html index.html search.html php-modindex.html)
(cd _build/html && find . -name '*.html' -exec sh -c 'xmllint {} --xpath '"'"'//div[@role="main"]'"'"' | xmllint --format - > ../../{}' \;)
sed -i -r 's~.*/(test/)~\1~;t;d' log.txt
sed -i -r 's~[^:]*/(test/)~\1~;t;d' baseline.txt

- name: Apply Coding Style
if: matrix.python == '3.11'
if: matrix.python == 'latest'
run: |
pip install black
python -m black .

- name: Diff Unit Tests Output and Coding Style
if: matrix.python == 'latest'
run: |
cd test
rm -r _build
git add . -N && git diff --exit-code

- name: Push Unit Tests Output
if: failure() && github.repository_owner != 'markstory' && matrix.python == '3.11'
if: failure() && github.repository_owner != 'markstory' && matrix.python == 'latest'
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: ${{ github.head_ref || github.ref_name }}.changes
Expand All @@ -78,7 +84,7 @@ jobs:
cd test
make html SPHINXOPTS='-W'

sed -i 's~, "log\.md"~~' conf.py
sed -i 's~, "logging\.md"~~' conf.py
! make html SPHINXOPTS='-W' || (echo 'Unexpected zero exit code'; false)
git restore conf.py

Expand Down
16 changes: 8 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
"""

setup(
name='sphinxcontrib-phpdomain',
version='0.11.2',
url='https://github.com/markstory/sphinxcontrib-phpdomain',
download_url='http://pypi.python.org/pypi/sphinxcontrib-phpdomain',
license='BSD',
author='Mark Story',
author_email='mark@mark-story.com',
description='Sphinx extension to enable documenting PHP code',
name="sphinxcontrib-phpdomain",
version="0.11.2",
url="https://github.com/markstory/sphinxcontrib-phpdomain",
download_url="http://pypi.python.org/pypi/sphinxcontrib-phpdomain",
license="BSD",
author="Mark Story",
author_email="mark@mark-story.com",
description="Sphinx extension to enable documenting PHP code",
long_description=long_desc,
project_urls={
"Documentation": "https://markstory.github.io/sphinxcontrib-phpdomain/",
Expand Down
2 changes: 1 addition & 1 deletion sphinxcontrib/phpdomain.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Sphinx PHP domain.

The PHP domain. Based off of the rubydomain by SHIBUKAWA Yoshiki

:copyright: Copyright 2016 by Mark Story
Expand Down
12 changes: 6 additions & 6 deletions test/log.txt → test/baseline.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
test/log.md:3: WARNING: Unknown directive type: 'php:namespacee' [myst.directive_unknown]
test/log.md:8: WARNING: [phpdomain] Invalid signature
test/log.md:13: [phpdomain] Target Foo\Aa not found
test/log.md:15: [phpdomain] Target Foo\A::simplifyy not found
test/log.md:20: [phpdomain] Target Foo\Foo\A::simplify not found - did you mean to write A::simplify?
test/log.md:25: [phpdomain] Target Fooo\Foo\A::simplify not found - did you mean to write \Foo\A::simplify?
test/logging.md:3: WARNING: Unknown directive type: 'php:namespacee' [myst.directive_unknown]
test/logging.md:8: WARNING: [phpdomain] Invalid signature
test/logging.md:13: [phpdomain] Target Foo\Aa not found
test/logging.md:15: [phpdomain] Target Foo\A::simplifyy not found
test/logging.md:20: [phpdomain] Target Foo\Foo\A::simplify not found - did you mean to write A::simplify?
test/logging.md:25: [phpdomain] Target Fooo\Foo\A::simplify not found - did you mean to write \Foo\A::simplify?
test/ns.md:48: [phpdomain] Target A2::simplify not found
test/ns.md:53: [phpdomain] Target Bar2\A::simplify not found
test/rst_doc.md:506: [phpdomain] Target OtherLibrary\int|string|ReturnedClass|\LibraryName\SubPackage\SubpackageInterface|null not found
Expand Down
2 changes: 1 addition & 1 deletion test/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
source_suffix = ".md"
master_doc = "index"

exclude_patterns = ["_build", "log.md"]
exclude_patterns = ["_build", "logging.md"]

html_theme = "default"
12 changes: 5 additions & 7 deletions test/log.html → test/logging.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0"?>
<div class="body" role="main">
<section id="invalid-domain-type">
<h1>Invalid domain type<a class="headerlink" href="#invalid-domain-type" title="Permalink to this heading">&#xB6;</a></h1>
<h1>Invalid domain type<a class="headerlink" href="#invalid-domain-type" title="Link to this heading">&#xB6;</a></h1>
</section>
<section id="invalid-signature">
<h1>Invalid signature<a class="headerlink" href="#invalid-signature" title="Permalink to this heading">&#xB6;</a></h1>
<h1>Invalid signature<a class="headerlink" href="#invalid-signature" title="Link to this heading">&#xB6;</a></h1>
<dl class="php method">
<dt class="sig sig-object php">
<span class="sig-name descname">
Expand All @@ -15,7 +15,7 @@ <h1>Invalid signature<a class="headerlink" href="#invalid-signature" title="Perm
</dl>
</section>
<section id="unresolved-references">
<h1>Unresolved references<a class="headerlink" href="#unresolved-references" title="Permalink to this heading">&#xB6;</a></h1>
<h1>Unresolved references<a class="headerlink" href="#unresolved-references" title="Link to this heading">&#xB6;</a></h1>
<ul class="simple">
<li>
<p>
Expand All @@ -32,8 +32,7 @@ <h1>Unresolved references<a class="headerlink" href="#unresolved-references" tit
</p>
</li>
</ul>
<span class="target" id="namespace-Foo"/>
<ul class="simple">
<ul class="simple" id="namespace-Foo">
<li>
<p>
<a class="reference internal" href="ns.html#Foo\A::simplify" title="Foo\A::simplify">
Expand All @@ -44,8 +43,7 @@ <h1>Unresolved references<a class="headerlink" href="#unresolved-references" tit
</p>
</li>
</ul>
<span class="target" id="namespace-Fooo"/>
<ul class="simple">
<ul class="simple" id="namespace-Fooo">
<li>
<p>
<a class="reference internal" href="ns.html#Foo\A::simplify" title="Foo\A::simplify">
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions test/method.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<div class="body" role="main">
<section id="simple-method">
<h1>Simple method<a class="headerlink" href="#simple-method" title="Permalink to this heading">&#xB6;</a></h1>
<h1>Simple method<a class="headerlink" href="#simple-method" title="Link to this heading">&#xB6;</a></h1>
<dl class="php class">
<dt class="sig sig-object php" id="Foo">
<em class="property">
Expand All @@ -10,12 +10,12 @@ <h1>Simple method<a class="headerlink" href="#simple-method" title="Permalink to
<span class="sig-name descname">
<span class="pre">Foo</span>
</span>
<a class="headerlink" href="#Foo" title="Permalink to this definition">&#xB6;</a>
<a class="headerlink" href="#Foo" title="Link to this definition">&#xB6;</a>
</dt>
<dd/>
</dl>
<dl class="php method">
<dt class="sig sig-object php" id="Foo::test"><span class="sig-prename descclassname"><span class="pre">Foo::</span></span><span class="sig-name descname"><span class="pre">test</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">$a</span></em>, <em class="sig-param"><span class="pre">...$args</span></em><span class="sig-paren">)</span><a class="headerlink" href="#Foo::test" title="Permalink to this definition">&#xB6;</a></dt>
<dt class="sig sig-object php" id="Foo::test"><span class="sig-prename descclassname"><span class="pre">Foo::</span></span><span class="sig-name descname"><span class="pre">test</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">$a</span></em>, <em class="sig-param"><span class="pre">...$args</span></em><span class="sig-paren">)</span><a class="headerlink" href="#Foo::test" title="Link to this definition">&#xB6;</a></dt>
<dd>
<p>Simple test method.</p>
<dl class="field-list simple">
Expand All @@ -31,7 +31,7 @@ <h1>Simple method<a class="headerlink" href="#simple-method" title="Permalink to
</dd>
</dl>
<section id="cross-linking">
<h2>Cross linking<a class="headerlink" href="#cross-linking" title="Permalink to this heading">&#xB6;</a></h2>
<h2>Cross linking<a class="headerlink" href="#cross-linking" title="Link to this heading">&#xB6;</a></h2>
<ul class="simple">
<li>
<p>
Expand Down
28 changes: 13 additions & 15 deletions test/ns.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="body" role="main">
<section id="namespace-Foo">
<span id="simple-ns"/>
<h1>Simple NS<a class="headerlink" href="#namespace-Foo" title="Permalink to this heading">&#xB6;</a></h1>
<h1>Simple NS<a class="headerlink" href="#namespace-Foo" title="Link to this heading">&#xB6;</a></h1>
<dl class="php class">
<dt class="sig sig-object php" id="Foo\A">
<em class="property">
Expand All @@ -14,7 +14,7 @@ <h1>Simple NS<a class="headerlink" href="#namespace-Foo" title="Permalink to thi
<span class="sig-name descname">
<span class="pre">A</span>
</span>
<a class="headerlink" href="#Foo\A" title="Permalink to this definition">&#xB6;</a>
<a class="headerlink" href="#Foo\A" title="Link to this definition">&#xB6;</a>
</dt>
<dd/>
</dl>
Expand All @@ -28,12 +28,12 @@ <h1>Simple NS<a class="headerlink" href="#namespace-Foo" title="Permalink to thi
</span>
<span class="sig-paren">(</span>
<span class="sig-paren">)</span>
<a class="headerlink" href="#Foo\A::simplify" title="Permalink to this definition">&#xB6;</a>
<a class="headerlink" href="#Foo\A::simplify" title="Link to this definition">&#xB6;</a>
</dt>
<dd/>
</dl>
<section id="cross-linking">
<h2>Cross linking<a class="headerlink" href="#cross-linking" title="Permalink to this heading">&#xB6;</a></h2>
<h2>Cross linking<a class="headerlink" href="#cross-linking" title="Link to this heading">&#xB6;</a></h2>
<ul class="simple">
<li>
<p>
Expand All @@ -49,7 +49,7 @@ <h2>Cross linking<a class="headerlink" href="#cross-linking" title="Permalink to
</section>
<section id="namespace-Foo\Bar">
<span id="ns-can-be-changed"/>
<h1>NS can be changed<a class="headerlink" href="#namespace-Foo\Bar" title="Permalink to this heading">&#xB6;</a></h1>
<h1>NS can be changed<a class="headerlink" href="#namespace-Foo\Bar" title="Link to this heading">&#xB6;</a></h1>
<dl class="php class">
<dt class="sig sig-object php" id="Foo\Bar\A">
<em class="property">
Expand All @@ -61,7 +61,7 @@ <h1>NS can be changed<a class="headerlink" href="#namespace-Foo\Bar" title="Perm
<span class="sig-name descname">
<span class="pre">A</span>
</span>
<a class="headerlink" href="#Foo\Bar\A" title="Permalink to this definition">&#xB6;</a>
<a class="headerlink" href="#Foo\Bar\A" title="Link to this definition">&#xB6;</a>
</dt>
<dd/>
</dl>
Expand All @@ -75,12 +75,11 @@ <h1>NS can be changed<a class="headerlink" href="#namespace-Foo\Bar" title="Perm
</span>
<span class="sig-paren">(</span>
<span class="sig-paren">)</span>
<a class="headerlink" href="#Foo\Bar\A::simplify" title="Permalink to this definition">&#xB6;</a>
<a class="headerlink" href="#Foo\Bar\A::simplify" title="Link to this definition">&#xB6;</a>
</dt>
<dd/>
</dl>
<span class="target" id="namespace-Bar"/>
<dl class="php class">
<dl class="php class" id="namespace-Bar">
<dt class="sig sig-object php" id="Bar\A">
<em class="property">
<span class="pre">class</span>
Expand All @@ -91,7 +90,7 @@ <h1>NS can be changed<a class="headerlink" href="#namespace-Foo\Bar" title="Perm
<span class="sig-name descname">
<span class="pre">A</span>
</span>
<a class="headerlink" href="#Bar\A" title="Permalink to this definition">&#xB6;</a>
<a class="headerlink" href="#Bar\A" title="Link to this definition">&#xB6;</a>
</dt>
<dd/>
</dl>
Expand All @@ -105,12 +104,12 @@ <h1>NS can be changed<a class="headerlink" href="#namespace-Foo\Bar" title="Perm
</span>
<span class="sig-paren">(</span>
<span class="sig-paren">)</span>
<a class="headerlink" href="#Bar\A::simplify" title="Permalink to this definition">&#xB6;</a>
<a class="headerlink" href="#Bar\A::simplify" title="Link to this definition">&#xB6;</a>
</dt>
<dd/>
</dl>
<section id="id1">
<h2>Cross linking<a class="headerlink" href="#id1" title="Permalink to this heading">&#xB6;</a></h2>
<h2>Cross linking<a class="headerlink" href="#id1" title="Link to this heading">&#xB6;</a></h2>
<ul class="simple">
<li>
<p>
Expand Down Expand Up @@ -143,7 +142,7 @@ <h2>Cross linking<a class="headerlink" href="#id1" title="Permalink to this head
</section>
</section>
<section id="ns-must-not-be-guessed">
<h1>NS must not be guessed<a class="headerlink" href="#ns-must-not-be-guessed" title="Permalink to this heading">&#xB6;</a></h1>
<h1>NS must not be guessed<a class="headerlink" href="#ns-must-not-be-guessed" title="Link to this heading">&#xB6;</a></h1>
<div class="note docutils">
<p>These cross references must not have a link as the target methods are not defined.</p>
</div>
Expand All @@ -156,8 +155,7 @@ <h1>NS must not be guessed<a class="headerlink" href="#ns-must-not-be-guessed" t
</p>
</li>
</ul>
<span class="target" id="namespace-Bar2"/>
<ul class="simple">
<ul class="simple" id="namespace-Bar2">
<li>
<p>
<code class="xref php php-meth docutils literal notranslate">
Expand Down
Loading