Skip to content

Run the docs404 on a schedule #6582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/404.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: 404 Test

# Runs at 10AM every day
on:
schedule:
- cron: "0 10 * * *"

env:
hugo_image_cache_name: hugo-generated-images
hugo_image_cache_path: /home/runner/work/docs-publishing/docs-publishing/docs-repo/resources/_gen/images/

jobs:
docs404:
runs-on: ubuntu-latest
steps:
- name: Checkout docs repo
uses: actions/checkout@v3
with:
path: 'docs-repo'
- name: List contents of images dir
continue-on-error: true
run: ls -al ${{ env.hugo_image_cache_path }}
- name: Restore Hugo generated images cache
uses: ylemkimon/cache-restore@v2
with:
path: ${{ env.hugo_image_cache_path }}
key: ${{ env.hugo_image_cache_name }}
restore-keys: ${{ env.hugo_image_cache_name }}
- name: List contents of images dir
continue-on-error: true
run: ls -al ${{ env.hugo_image_cache_path }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10.x'
architecture: 'x64'
cache: pip
- name: Install dependencies (Python)
working-directory: ./docs-repo
run: |
pip install -r ./ci/requirements.txt
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '14.x'
- name: Install dependencies (Node)
working-directory: ./docs-repo
run: npm ci
- name: Set up Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.116.1'
- name: Start Hugo server
working-directory: ./docs-repo
run: |
# Start Hugo in background:
hugo server &

# Wait for server to start
# (or possibly fail to start):
while true
do
# Check if the server is responding on 1313,
# which means that the Hugo build finished.
if nc -z localhost 1313
then
exit 0
fi

# Check if the Hugo process is still running.
# If not, then the server failed to build.
if ! pgrep hugo > /dev/null
then
exit 1
fi

sleep 1
done
- name: Run tests
working-directory: ./docs-repo
run: python ./ci/docs404.py