feat: optimize code preview in docs #1016
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
branches: | |
- main | |
name: Test project | |
jobs: | |
wait_for_vercel: | |
name: Wait for Vercel preview | |
runs-on: ubuntu-latest | |
outputs: | |
preview_url: ${{ steps.waitForVercelPreviewDeployment.outputs.url }} | |
steps: | |
- name: Wait for Vercel preview deployment to be ready | |
uses: patrickedqvist/[email protected] | |
id: waitForVercelPreviewDeployment | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
max_timeout: 600 | |
pa11y: | |
name: Pa11y tests | |
needs: wait_for_vercel | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Fixup git permissions | |
# https://github.com/actions/checkout/issues/766 | |
shell: bash | |
run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 20.x | |
- run: npm install -g pa11y-ci --unsafe-perm=true | |
- run: pa11y-ci --sitemap ${{ needs.wait_for_vercel.outputs.preview_url }}/sitemap.xml --sitemap-find ^/ --sitemap-replace '${{ needs.wait_for_vercel.outputs.preview_url }}/' | |
htmlproofer: | |
name: HtmlProofer tests | |
runs-on: ubuntu-latest | |
container: | |
image: timbru31/ruby-node:3.0-16 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Fixup git permissions | |
# https://github.com/actions/checkout/issues/766 | |
shell: bash | |
run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- run: bundle install | |
- run: chmod -R 777 . | |
- run: npm ci | |
- run: npm run build | |
- run: npm run test-htmlproofer |