Skip to content

Commit

Permalink
update website Actions workflows
Browse files Browse the repository at this point in the history
DaveSkender committed Dec 24, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 993d77d commit b7427ff
Showing 3 changed files with 76 additions and 80 deletions.
71 changes: 36 additions & 35 deletions .github/workflows/test-website-a11y.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,59 @@
# Checks website for accessiblity issues
name: Website a11y

on:
pull_request:
branches: ["*"]
paths:
- docs/**
- .github/workflows/test-website-a11y.yml

env:
JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- "docs/**"
workflow_dispatch:

jobs:
test:
name: test
runs-on: ubuntu-latest

env:
BUNDLE_GEMFILE: ${{github.workspace}}/docs/GemFile
defaults:
run:
working-directory: docs

steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Setup Ruby
uses: ruby/setup-ruby@v1
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
working-directory: docs
ruby-version: 3.3
dotnet-version: '9.x'

- name: Install GEMs
working-directory: docs
run: |
pwd
bundle install
- name: Build site
working-directory: docs
run: bundle exec jekyll build
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'

- name: Serve site
working-directory: docs
run: bundle exec jekyll serve --detach
- name: Install dependencies
run: |
dotnet tool install -g docfx
npm install -g pa11y-ci
- name: Show environment
working-directory: docs
run: npx pa11y --environment
- name: Build and serve site
run: |
docfx build --serve --port 4000 --detach
echo "Waiting up to 30s for server to start..."
timeout=30
until curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:4000 | grep -q "200"; do
if [ $timeout -le 0 ]; then
echo "Server failed to start after ${timeout}s"
exit 1
fi
timeout=$((timeout-1))
sleep 1
done
- name: Test accessibility
working-directory: docs
run: |
npx pa11y-ci \
--sitemap http://127.0.0.1:4000/sitemap.xml \
--sitemap-exclude "/*.pdf"
run: >
pa11y-ci
--sitemap http://127.0.0.1:4000/sitemap.xml
--config ./.pa11yci
--threshold 10
- name: Kill site (failsafe)
if: always()
run: pkill -f jekyll
run: pkill -f docfx
79 changes: 36 additions & 43 deletions .github/workflows/test-website-links.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
name: Website URLs
# Checks website for broken links
name: Website Links

on:
pull_request:
branches: ["*"]
paths:
- docs/**
- .github/workflows/test-website-links.yml

env:
JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- "docs/**"
workflow_dispatch:

jobs:
test:
name: test
test-links:
runs-on: ubuntu-latest
defaults:
run:
working-directory: docs

steps:
- name: Checkout source
@@ -22,59 +21,53 @@ jobs:
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
working-directory: docs
ruby-version: 3.3
ruby-version: '3.2'

- name: Install GEMs
working-directory: docs
env:
BUNDLE_GEMFILE: ${{github.workspace}}/docs/GemFile
run: |
pwd
bundle install
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.x'

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'

- name: Setup HTML Proofer
- name: Install dependencies
run: |
gem install html-proofer
htmlproofer --help
- name: Replace "data-src"
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "data-src"
replace: "src"
regex: false
dotnet tool install -g docfx
- name: Replace "dotnet.stockindicators.dev"
- name: Use local website URL
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "https://dotnet.stockindicators.dev"
replace: "http://127.0.0.1:4000"
regex: false
include: "docs/**"

- name: Build site
working-directory: docs
env:
BUNDLE_GEMFILE: ${{github.workspace}}/docs/GemFile
run: bundle exec jekyll build --trace

- name: Serve site
working-directory: docs
env:
BUNDLE_GEMFILE: ${{github.workspace}}/docs/GemFile
run: bundle exec jekyll serve --detach
- name: Build and serve site
run: |
docfx build --serve --port 4000 --detach
echo "Waiting up to 30s for server to start..."
timeout=30
until curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:4000 | grep -q "200"; do
if [ $timeout -le 0 ]; then
echo "Server failed to start after ${timeout}s"
exit 1
fi
timeout=$((timeout-1))
sleep 1
done
# see help in setup step
- name: Test for broken URLs
working-directory: docs
run: |
htmlproofer _site \
--no-enforce-https \
--no-check-external-hash \
--ignore-status-codes "0,302,403,406,408,429,503,999" \
--swap-urls "https\://dotnet.stockindicators.dev:http\://127.0.0.1:4000" \
--ignore-urls "/fonts.gstatic.com/"
- name: Kill site (failsafe)
if: always()
run: pkill -f jekyll
run: pkill -f docfx
6 changes: 4 additions & 2 deletions docs/.pa11yci
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"defaults": {
"concurrency": 1,
"timeout": 30000,
"wait": 1000,
"standard": "WCAG2AA",
"runners": ["htmlcs"],
"hideElements": "#searchzone"
"hideElements": "#searchzone",
"port": 4000
}
}

0 comments on commit b7427ff

Please sign in to comment.