Skip to content

Commit

Permalink
Docs : Configure Doxygen and GitHub pages deploy Action (p4lang#4702)
Browse files Browse the repository at this point in the history
* Feat: Migrate from PNG to SVG graphs

* Move: P4 logo to assets directory

* Branding: Add P4 favicon to generated Docs

* Docs : Disable full path names

* Feat : GitHub Actions for building and deploying Documentaion

Overview of Action
- Set up workflow to trigger on push to main branch
- Install Doxygen and Graphviz
- Generate Doxygen documentation
- Deploy generated documentation to GitHub Pages
  • Loading branch information
AdarshRawat1 authored Jun 17, 2024
1 parent 68c0ddd commit 7f98dad
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 7 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build Doxygen and deploy to GitHub Pages
permissions:
actions: read
contents: write
pages: write

on:
push:
branches:
- main

jobs:
build-and-deploy:
runs-on: ubuntu-latest
concurrency: ci-${{github. ref}}
steps:
- name : Checkout
uses: actions/checkout@v4

- name: Install Doxygen
run: sudo apt-get install doxygen graphviz -y
shell: bash

- name: Generate Doxygen Documentation
run: |
cd docs/doxygen
doxygen doxygen.cfg
shell: bash

- name: Create .nojekyll
run: |
cd docs/doxygen/build
touch html/.nojekyll
shell: bash

- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: docs/doxygen/build/html
8 changes: 8 additions & 0 deletions docs/assets/p4-fav.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
1 change: 1 addition & 0 deletions docs/doxygen/bfn_footer.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
%%BEGIN COMPACT_LATEX
12 changes: 6 additions & 6 deletions docs/doxygen/doxygen.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ PROJECT_BRIEF = "The P4 Compiler"
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.

PROJECT_LOGO = ./p4-logo.png
PROJECT_LOGO = ../assets/p4-logo.png

# With the PROJECT_ICON tag one can specify an icon that is included in the tabs
# when the HTML document is shown. Doxygen will copy the logo to the output
# directory.

PROJECT_ICON =
PROJECT_ICON = ../assets/p4-fav.svg

# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
Expand Down Expand Up @@ -168,7 +168,7 @@ INLINE_INHERITED_MEMB = NO
# shortest path that makes the file name unique will be used
# The default value is: YES.

FULL_PATH_NAMES = YES
FULL_PATH_NAMES = NO

# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
# Stripping is only done if one of the specified strings matches the left-hand
Expand Down Expand Up @@ -1058,7 +1058,7 @@ EXAMPLE_RECURSIVE = NO
# that contain images that are to be included in the documentation (see the
# \image command).

IMAGE_PATH = ../../docs/doxygen
IMAGE_PATH = ../../docs/assets

# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
Expand Down Expand Up @@ -2729,7 +2729,7 @@ DIR_GRAPH_MAX_DEPTH = 1
# The default value is: png.
# This tag requires that the tag HAVE_DOT is set to YES.

DOT_IMAGE_FORMAT = png
DOT_IMAGE_FORMAT = svg

# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
# enable generation of interactive SVG images that allow zooming and panning.
Expand All @@ -2741,7 +2741,7 @@ DOT_IMAGE_FORMAT = png
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.

INTERACTIVE_SVG = NO
INTERACTIVE_SVG = YES

# The DOT_PATH tag can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found in the path.
Expand Down
2 changes: 1 addition & 1 deletion docs/doxygen/p4c_header.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
<!--BEGIN PROJECT_ICON-->
<link rel="icon" href="$relpath^$projecticon" type="image/x-icon" />
<link rel="icon" href="$relpath^$projecticon" type="image/svg+xml" />
<!--END PROJECT_ICON-->
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
<!--BEGIN DISABLE_INDEX-->
Expand Down

0 comments on commit 7f98dad

Please sign in to comment.