From 1f5dd0d270d14bca8e17d43f2cede6a5b6d7639d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 28 Sep 2024 13:13:32 +0200 Subject: [PATCH] Implement documentation action I did not make anything configurable because the right versions to use depend more on doctrine/doctrine-website than on the consuming project itself. --- .github/workflows/documentation.yml | 46 +++++++++++++++++++ .../documentation.properties.json | 11 +++++ workflow-templates/documentation.yml | 21 +++++++++ 3 files changed, 78 insertions(+) create mode 100644 .github/workflows/documentation.yml create mode 100644 workflow-templates/documentation.properties.json create mode 100644 workflow-templates/documentation.yml diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000..5a01c66 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,46 @@ + +name: "Documentation" + +on: + workflow_call: + +jobs: + guides: + name: "phpDocumentor Guides" + runs-on: "ubuntu-22.04" + + strategy: + matrix: + php-version: + - "8.3" # Use the same version as in doctrine/doctrine-website + + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "none" + php-version: "${{ matrix.php-version }}" + tools: "cs2pr" + + # Some of our dependencies have supported branches where they still need + # to support PHP < 8.1. For that reason, let us not even attempt to install + # the usual dependencies and start from scratch. + - name: "Remove existing composer file" + run: "rm composer.json" + + - name: "Require phpdocumentor/guides-cli" + # We use the same version constraint as in doctrine/doctrine-website + run: "composer require --dev phpdocumentor/guides-cli '^1.4' --no-update" + + - name: "Install dependencies with Composer" + uses: "ramsey/composer-install@v3" + with: + dependency-versions: "highest" + composer-options: "${{ inputs.composer-options }}" + + - name: "Run guides" + run: | + vendor/bin/guides -vvv --no-progress --fail-on-log docs/en diff --git a/workflow-templates/documentation.properties.json b/workflow-templates/documentation.properties.json new file mode 100644 index 0000000..930d02d --- /dev/null +++ b/workflow-templates/documentation.properties.json @@ -0,0 +1,11 @@ +{ + "name": "Documentation", + "description": "Validates the documentation", + "iconName": "doctrine-logo", + "categories": [ + "RST" + ], + "filePatterns": [ + "^guides\\.xml$" + ] +} diff --git a/workflow-templates/documentation.yml b/workflow-templates/documentation.yml new file mode 100644 index 0000000..1cd616a --- /dev/null +++ b/workflow-templates/documentation.yml @@ -0,0 +1,21 @@ + +name: "Documentation" + +on: + pull_request: + branches: + - "*.x" + paths: + - ".github/workflows/documentation.yml" + - "docs/**" + push: + branches: + - "*.x" + paths: + - ".github/workflows/documentation.yml" + - "docs/**" + +jobs: + documentation: + name: "Documentation" + uses: "doctrine/.github/.github/workflows/documentation.yml@use_a_valid_ref_here"