Skip to content

Vortex - Test docs #3284

Vortex - Test docs

Vortex - Test docs #3284

# This action is used for Vortex maintenance. It will not be used in the scaffolded project.
name: Vortex - Test docs
on:
workflow_run:
workflows: ['Vortex - Test installer']
types:
- completed
jobs:
vortex-test-docs:
runs-on: ubuntu-latest
# Only run if installer workflow succeeded
if: github.event.workflow_run.conclusion == 'success'
steps:
# Post pending status to the PR commit.
# Workflows triggered by workflow_run don't automatically report status
# on the triggering PR, so we need to do it manually.
- name: Set pending commit status
run: |
gh api repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_sha }} \
-f state=pending \
-f context="Vortex - Test docs" \
-f description="Running documentation tests..." \
-f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
env:
GH_TOKEN: ${{ github.token }}
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
ref: ${{ github.event.workflow_run.head_sha }}
- name: Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: 22.17.1
- name: Setup PHP
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2
with:
php-version: 8.3
- name: Download installer artifact
uses: dawidd6/action-download-artifact@8305c0f1062bb0d184d09ef4493ecb9288447732 # v20
with:
workflow: vortex-test-installer.yml
name: vortex-installer
path: .vortex/docs/static
if_no_artifact_found: fail
allow_forks: true
- name: Copy installer to docs
run: |
mv .vortex/docs/static/installer.phar .vortex/docs/static/install
php .vortex/docs/static/install --version
- name: Check docs up-to-date
run: |
yarn run update-variables
git diff --quiet HEAD || { echo "Docs not up-to-date. Run 'cd .vortex && ahoy update-docs' and commit changes."; git diff; exit 1; }
working-directory: '${{ github.workspace }}/.vortex/docs'
- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: '${{ github.workspace }}/.vortex/docs'
- name: Lint code
run: yarn run lint
working-directory: '${{ github.workspace }}/.vortex/docs'
- name: Run tests
run: yarn run test:coverage
working-directory: '${{ github.workspace }}/.vortex/docs'
- name: Check spelling
run: yarn run spellcheck
working-directory: '${{ github.workspace }}/.vortex/docs'
- name: Build documentation site
run: yarn run build
working-directory: '${{ github.workspace }}/.vortex/docs'
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@4cbaf4c08f1a7bfa537d6113472ef4424e4eb654 # v3.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
publish-dir: '.vortex/docs/build'
production-branch: main
deploy-message: "Deploy from GitHub Actions"
enable-pull-request-comment: true
enable-commit-comment: true
overwrites-pull-request-comment: true
env:
NETLIFY_SITE_ID: ${{ secrets.DOCS_NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.DOCS_NETLIFY_AUTH_TOKEN }}
timeout-minutes: 1
- name: Upload coverage reports as an artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: ${{github.job}}-docs-coverage-report
path: .vortex/docs/.logs
include-hidden-files: true
if-no-files-found: error
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6
with:
files: .vortex/docs/.logs/cobertura.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
# Post final status to the PR commit.
- name: Set final commit status
if: always()
run: |
state=${{ job.status == 'success' && 'success' || 'failure' }}
description=${{ job.status == 'success' && '"Documentation tests passed"' || '"Documentation tests failed"' }}
gh api repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_sha }} \
-f state="${state}" \
-f context="Vortex - Test docs" \
-f description="${description}" \
-f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
env:
GH_TOKEN: ${{ github.token }}