Skip to content

Merge pull request #11 from overr4m/cleanup-git-history #57

Merge pull request #11 from overr4m/cleanup-git-history

Merge pull request #11 from overr4m/cleanup-git-history #57

Workflow file for this run

name: ci
on:
push:
branches:
- master
pull_request:
branches:
- develop
permissions:
contents: read
pages: write
id-token: write
packages: write
deployments: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
linter_checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: pip-${{ runner.os }}-
- name: Install development dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
# - name: Lint and format with ruff
# run: |
# ruff check .
# ruff format --check .
- name: Lint with flake8
run: |
pip install flake8
flake8 . \
--statistics \
--show-source
- name: Type checking with mypy
run: |
pip install mypy
mypy . --config-file mypy.ini
# docs_linter_checks:
# runs-on: ubuntu-latest
# needs: linter_checks
# steps:
# - uses: actions/checkout@v4
# - name: Install yamllint
# run: pip install yamllint
# - name: Run yamllint
# run: |
# yamllint --no-warnings .github/workflows mkdocs.yml
# - name: Run markdownlint
# uses: DavidAnson/markdownlint-cli2-action@v20
# with:
# globs: |
# docs/**/*.md
# README.md
# SECURITY.md
# CODE_OF_CONDUCT.md
# CONTRIBUTING.md
# RELEASE_NOTES.md
# NOTICE.md
# LICENSE.md
layout_linter_checks:
runs-on: ubuntu-latest
needs: linter_checks
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install JS/CSS linters
run: |
npm install --save-dev eslint stylelint
- name: Lint JavaScript in docs
run: |
if ls docs/javascripts/**/*.js >/dev/null 2>&1; then
npx eslint "docs/javascripts/**/*.js"
fi
if [ -f "eslint.config.js" ]; then
echo "Using eslint.config.js from repo root"
fi
- name: Lint CSS in docs
run: |
if ls docs/stylesheets/**/*.css >/dev/null 2>&1; then
npx stylelint "docs/stylesheets/**/*.css"
fi
if [ -f "stylelint.config.cjs" ]; then
echo "Using stylelint.config.cjs from repo root"
fi
dependency_audit_checks:
runs-on: ubuntu-latest
needs:
- linter_checks
- layout_linter_checks
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: |
pip install --upgrade pip
pip install -r requirements.txt pip-audit
pip-audit -r requirements.txt
security_py_dependency_checks:
runs-on: ubuntu-latest
needs:
- linter_checks
- layout_linter_checks
- dependency_audit_checks
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Python security tools
run: |
pip install --upgrade pip
pip install bandit safety -r requirements.txt
- name: Security scan with bandit
run: |
bandit -r main.py scripts -ll
- name: Dependency security check with safety
run: |
safety check -r requirements.txt || true
# security_secrets_checks:
# runs-on: ubuntu-latest
# needs:
# - linter_checks
# - layout_linter_checks
# - dependency_audit_checks
# steps:
# - uses: actions/checkout@v4
# - name: Scan repository for secrets with gitleaks
# uses: gitleaks/gitleaks-action@v2
# with:
# config-path: .gitleaks.toml
docs-preview:
if: github.event_name == 'pull_request'
needs:
- linter_checks
# - docs_linter_checks
- layout_linter_checks
- dependency_audit_checks
- security_py_dependency_checks
# - security_secrets_checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: pip-${{ runner.os }}-
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
- name: Build tools.json (preview)
run: |
python scripts/build_search_data.py
env:
PYTHONPATH: .
- name: Validate MkDocs config (preview)
run: |
mkdocs build --clean --config-file mkdocs.yml --site-dir /tmp/mkdocs-check
env:
PYTHONPATH: .
- name: Ensure pdf_table directory exists (preview)
run: |
mkdir -p docs/pdf_table
- name: Generate tools map PDF (preview)
run: |
python scripts/export_tools_pdf.py \
--output docs/pdf_table/tools-map.pdf
- name: Build MkDocs site (preview)
run: |
mkdocs build --site-dir site
env:
PYTHONPATH: .
- name: Upload preview artifact
uses: actions/upload-artifact@v4
with:
name: site-preview
path: site
build:
if: github.event_name == 'push'
needs:
- linter_checks
# - docs_linter_checks
- layout_linter_checks
- dependency_audit_checks
- security_py_dependency_checks
# - security_secrets_checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: pip-${{ runner.os }}-
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
- name: Build tools.json
run: |
python scripts/build_search_data.py
env:
PYTHONPATH: .
- name: Validate MkDocs config
run: |
mkdocs build --clean --config-file mkdocs.yml --site-dir /tmp/mkdocs-check
env:
PYTHONPATH: .
- name: Ensure pdf_table directory exists
run: |
mkdir -p docs/pdf_table
- name: Generate tools map PDF
run: |
python scripts/export_tools_pdf.py \
--output docs/pdf_table/tools-map.pdf
env:
PYTHONPATH: .
- name: Build MkDocs site
run: |
mkdocs build --site-dir site
env:
PYTHONPATH: .
- name: Generate sitemap.xml
run: |
python scripts/generate_sitemap.py || echo "No sitemap generator, skipping."
- name: Ensure site directory exists
run: |
if [ ! -d "site" ]; then
echo "site directory is missing"
exit 1
fi
- name: Upload artifact for GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: site
- name: Check links with lychee
uses: lycheeverse/lychee-action@v1
with:
args: ./site/**/*.html
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy:
name: Deploy to GitHub Pages
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/master')
needs:
- build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Create GitHub Deployment
uses: chrnorm/deployment-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: production
environment-url: ${{ steps.deployment.outputs.page_url }}
transient-environment: false
production-environment: true