Skip to content

Added main page to the Doxygen docs (and comment to main.cpp) #367

Added main page to the Doxygen docs (and comment to main.cpp)

Added main page to the Doxygen docs (and comment to main.cpp) #367

name: Deploy Jekyll Site
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
paths:
- "wiki/**"
- "src/**"
- "test-suite/**"
- "makefile"
- "Doxyfile"
- ".github/workflows/jekyll-gh-pages.yml"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Build job
build:
runs-on: ubuntu-22.04
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} # Conditional check to ensure the job only runs on GitHub Actions
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: true
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install Node.js dependencies
run: |
cd wiki/_includes/code
npm install vscode-textmate vscode-oniguruma
- name: Run Node.js Code Highlighter
run: |
cd wiki/_includes/code
bash ./colorize-all.sh
- name: Check if source or tests have changed
id: code_changed
uses: dorny/paths-filter@v2
with:
filters: |
code:
- 'src/**'
- 'stdlib/**'
- 'test-suite/**'
- '.github/workflows/jekyll-gh-pages.yml'
- 'makefile'
- 'Doxyfile'
- name: Install build dependencies
if: steps.code_changed.outputs.code == 'true'
run: |
sudo apt-get update
sudo apt-get install build-essential antlr4 libantlr4-runtime-dev doxygen graphviz
- name: Run tests and generate test stats SVG
if: steps.code_changed.outputs.code == 'true'
run: |
bash wiki/_includes/code/run-tests.sh
- name: Preserve old test stats SVG
if: steps.code_changed.outputs.code == 'false'
run: |
curl -o wiki/test-results.svg https://bpp.sh/test-results.svg
curl -o wiki/badge.svg https://bpp.sh/badge.svg
- name: Generate STL documentation
if: steps.code_changed.outputs.code == 'true'
run: |
sudo apt-get install git
git clone https://github.com/rail5/autodoc-bpp.git autodoc-bpp
# In the file 'autodoc-bpp/autodoc.bpp', replace "<Array>" with "<Array.bpp>" so that we can build using the local STL
sed -i 's/<Array>/<Array.bpp>/g' autodoc-bpp/autodoc.bpp
# Generate the docs with autodoc-bpp
bin/bpp -I$(pwd)/stdlib/ autodoc-bpp/autodoc.bpp -d "$(pwd)/stdlib/" -n "Bash++ Standard Library" -e -o "wiki/stl/" -m md
# Create copies for each of these to preserve their sources
for file in wiki/stl/*.md; do
cp "$file" wiki/stl/$(basename $file .md).source.txt
done
# These copies will be used in later runs to preserve the old documentation if we don't need to regenerate it
- name: Preserve old STL documentation
if: steps.code_changed.outputs.code == 'false'
run: |
links=$(curl -s https://bpp.sh/stl/index.html | grep -oP 'href=".*?stl/.*"' | sed 's/href="//' | sed 's/"//')
for link in $links; do
# If the link does not end in .html, skip it
if [[ $link != *.html ]]; then
continue
fi
echo "Found $link"
echo "Downloading https://bpp.sh/stl/$(basename $link .html).source.txt --> wiki/stl/$(basename $link .html).md"
curl -o "wiki/stl/$(basename $link .html).md" "https://bpp.sh/stl/$(basename $link .html).source.txt"
for file in wiki/stl/*.md; do
cp "$file" wiki/stl/$(basename $file .md).source.txt
done
done
- name: Generate Doxygen internal technical documentation
if: steps.code_changed.outputs.code == 'true'
run: |
doxygen Doxyfile
# Copy the generated documentation to the wiki
mkdir -p wiki/doxygen
cp -r docs/html/* wiki/doxygen/
- name: Preserve old Doxygen internal technical documentation
if: steps.code_changed.outputs.code == 'false'
run: |
# Download the old documentation from the website
sudo apt-get install wget
mkdir -p wiki/doxygen
wget -mpEk https://bpp.sh/doxygen/
cp -r bpp.sh/doxygen/* wiki/doxygen/
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./wiki/
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4