Skip to content

Checks

Checks #981

Workflow file for this run

name: Checks
env:
MODULE_LIST_PATH: docs/assets/module-list.json
on:
push:
branches-ignore: [main]
repository_dispatch:
workflow_dispatch:
inputs:
fileList:
description: Files to Lint (space delimited). Use `docs/**/*.md` to lint all.
required: true
default: "docs/CONTRIBUTING.md"
type: string
checkSpelling:
description: Check Spelling
default: true
type: boolean
checkProse:
description: Check Prose
default: true
type: boolean
checkMarkdown:
description: Check Markdown
default: true
type: boolean
checkMeta:
description: Check Meta
default: true
type: boolean
checkSlurm:
description: Check Slurm
default: true
type: boolean
testBuild:
description: Test Build
default: true
type: boolean
jobs:
get:
name: Determine what files to check
runs-on: ubuntu-22.04
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: get-changed-files
uses: tj-actions/changed-files@v40
with:
files: |
docs/**/*.md
- name: Push Changed files to output
if: inputs.fileList == ''
id: diff
run: |
echo "::info::Workflow triggered by PR"
echo "Changed files: '${{steps.get-changed-files.outputs.all_changed_files}}'"
echo "filelist=${{steps.get-changed-files.outputs.all_changed_files}}" >> $GITHUB_OUTPUT
outputs:
filelist: ${{steps.diff.outputs.filelist || inputs.fileList}}
spellcheck:
name: Check Spelling
if: ${{ github.event_name != 'workflow_dispatch' || inputs.checkSpelling }}
runs-on: ubuntu-22.04
needs: get
steps:
- if: (needs.get.outputs.filelist)
name: No files to spellcheck
run: exit 0
- if: (needs.get.outputs.filelist)
name: Check out repo.
uses: actions/checkout@v4
- if: (needs.get.outputs.filelist)
name: Install dependencies
run: |
sudo apt install -y aspell
pip install pyspelling flashtext
- if: ${{needs.get.outputs.filelist}}
name: Run pyspelling
run: |
shopt -s globstar extglob
python3 checks/run_pyspelling.py ${{needs.get.outputs.filelist}}
proselint:
name: Check Prose
if: ${{github.event_name != 'workflow_dispatch'|| inputs.checkProse}}
runs-on: ubuntu-22.04
needs: get
steps:
- if: ${{! needs.get.outputs.filelist}}
name: No files to proselint
run: exit 0
- if: ${{needs.get.outputs.filelist}}
name: Check out repo.
uses: actions/checkout@v4
- if: ${{needs.get.outputs.filelist}}
name: Install dependencies
run: pip install proselint
- if: ${{needs.get.outputs.filelist}}
name: Run proselint
run: |
shopt -s globstar extglob
python3 checks/run_proselint.py ${{needs.get.outputs.filelist}}
mdlint:
name: Check Markdown
if: ${{github.event_name != 'workflow_dispatch' || inputs.checkMarkdown}}
runs-on: ubuntu-22.04
needs: get
steps:
- if: ${{! needs.get.outputs.filelist}}
name: No files to check Markdown
run: exit 0
- if: ${{needs.get.outputs.filelist}}
name: Check out repo.
uses: actions/checkout@v4
- if: ${{needs.get.outputs.filelist}}
name: Install dependencies
run: npm install -g markdownlint-cli
- if: ${{needs.get.outputs.filelist}}
name: Run markdownlint
run: |
shopt -s globstar extglob
markdownlint --config .markdownlint.json --json ${{needs.get.outputs.filelist}} 2>&1 | checks/parse_markdownlint.py
metacheck:
name: Check page meta
if: ${{github.event_name != 'workflow_dispatch'|| inputs.checkMeta}}
runs-on: ubuntu-22.04
needs: get
steps:
- if: ${{ ! needs.get.outputs.filelist}}
name: No files to check meta on.
run: exit 0
- if: ${{needs.get.outputs.filelist}}
name: Check out repo.
uses: actions/checkout@v4
- if: ${{needs.get.outputs.filelist}}
name: Check markdown meta.
run: |
shopt -s globstar extglob
python3 checks/run_meta_check.py ${{needs.get.outputs.filelist}}
slurmcheck:
name: Check slurm scripts
if: ${{github.event_name != 'workflow_dispatch'|| inputs.checkSlurm}}
runs-on: ubuntu-22.04
needs: get
steps:
- if: ${{ ! needs.get.outputs.filelist}}
name: No files to check meta on.
run: exit 0
- if: ${{needs.get.outputs.filelist}}
name: Check out repo.
uses: actions/checkout@v4
- if: ${{needs.get.outputs.filelist}}
name: Check markdown meta.
run: |
shopt -s globstar extglob
python3 checks/run_slurm_lint.py ${{needs.get.outputs.filelist}}
testBuild:
name: Test build
if: ${{github.event_name != 'workflow_dispatch' || inputs.testBuild}}
runs-on: ubuntu-22.04
needs: get
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: pip install -r requirements.txt
- run: echo "::group::Test Build"
- run: ./checks/run_test_build.py
- run: echo "::endgroup::"