Skip to content

Vortex - Test docs #2603

Vortex - Test docs

Vortex - Test docs #2603

# 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
fetch-depth: 0
ref: ${{ github.event.workflow_run.head_sha }}
- name: Setup Node.js
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6
with:
node-version: 22.17.1
- name: Setup PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
with:
php-version: 8.3
- name: Download installer artifact
uses: dawidd6/action-download-artifact@0bd50d53a6d7fb5cb921e607957e9cc12b4ce392 # v12
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@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
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@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
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 }}