Added PhpDoc generating to CI (test)

This commit is contained in:
netkas 2024-10-08 14:18:11 -04:00
parent dc9ca57e52
commit e1f0b459d8
2 changed files with 57 additions and 0 deletions

View file

@ -75,6 +75,48 @@ jobs:
echo "phpunit-exists=false" >> $GITHUB_OUTPUT
fi
check-phpdoc:
runs-on: ubuntu-latest
outputs:
phpdoc-exists: ${{ steps.check.outputs.phpdoc-exists }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check for phpdoc.xml
id: check
run: |
if [ -f phpdoc.xml ]; then
echo "phpdoc-exists=true" >> $GITHUB_OUTPUT
else
echo "phpdoc-exists=false" >> $GITHUB_OUTPUT
fi
generate_phpdoc:
needs: [build, check-phpdoc]
runs-on: ubuntu-latest
container:
image: php:8.3
if: needs.check-phpdoc.outputs.phpdoc-exists == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download PHPDocumentor
run: |
wget https://phpdoc.org/phpDocumentor.phar
chmod +x phpDocumentor.phar
- name: Generate PHPDoc
run: |
php phpDocumentor.phar -d src -t docs
- name: Upload PHPDoc
uses: actions/upload-artifact@v4
with:
name: phpdoc
path: docs
test:
needs: [build, check-phpunit]
runs-on: ubuntu-latest

15
phpdoc.dist.xml Normal file
View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<phpdocumentor configVersion="3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://www.phpdoc.org" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/phpDocumentor/phpDocumentor/master/data/xsd/phpdoc.xsd">
<paths>
<output>build/docs</output>
<cache>build/cache</cache>
</paths>
<version number="latest">
<api>
<source dsn=".">
<path>src/TgBotLib</path>
</source>
<default-package-name>net.nosial.tgbotlib</default-package-name>
</api>
</version>
</phpdocumentor>