From 6932907f05fa7033c173efeb8a3a2fbbe98f4154 Mon Sep 17 00:00:00 2001 From: Divlo Date: Fri, 6 Jan 2023 16:32:29 +0100 Subject: [PATCH] feat: generate documentation fixes #1 --- .github/workflows/release.yml | 14 +++++++-- .gitignore | 1 + .gitmodules | 3 ++ Doxyfile | 28 +++++++++++++++++ DoxygenLayout.xml | 57 +++++++++++++++++++++++++++++++++++ Makefile | 6 +++- README.md | 3 ++ 7 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 .gitmodules create mode 100644 Doxyfile create mode 100644 DoxygenLayout.xml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1183ec7..e1f642b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,17 +21,20 @@ jobs: git_commit_gpgsign: true - name: 'Install Build Tools' - run: 'sudo apt-get install --yes build-essential gcc make clang-format' + run: 'sudo apt-get install --yes build-essential gcc make clang-format doxygen doxygen-gui doxygen-doc graphviz' - run: 'make set_version' + - name: 'Generate Documentation' + run: 'make documentation' + - name: 'Use Node.js' uses: 'actions/setup-node@v3.1.0' with: node-version: 'lts/*' - name: 'Install Release Tools' - run: 'npm install --save-dev semantic-release @commitlint/cli @commitlint/config-conventional @semantic-release/git @semantic-release/exec @saithodev/semantic-release-backmerge' + run: 'npm install --save-dev semantic-release @commitlint/cli @commitlint/config-conventional @semantic-release/git @semantic-release/exec @saithodev/semantic-release-backmerge vercel' - run: 'rm --force package.json package-lock.json' @@ -41,3 +44,10 @@ jobs: GH_TOKEN: ${{ secrets.GH_TOKEN }} GIT_COMMITTER_NAME: ${{ secrets.GIT_NAME }} GIT_COMMITTER_EMAIL: ${{ secrets.GIT_EMAIL }} + + - name: 'Deploy to Vercel' + run: 'npx vercel ./documentation/html --token="${VERCEL_TOKEN}" --prod' + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} diff --git a/.gitignore b/.gitignore index 123087c..0b86377 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ bin *.exe *.a node_modules +documentation diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..d8da1e4 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "doxygen-awesome-css"] + path = doxygen-awesome-css + url = https://github.com/jothepro/doxygen-awesome-css.git diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 0000000..13c5cf0 --- /dev/null +++ b/Doxyfile @@ -0,0 +1,28 @@ +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = libcproject +PROJECT_BRIEF = "C static library easier to use than $(libc) (C standard library)." +OUTPUT_DIRECTORY = documentation +OUTPUT_LANGUAGE = English +OPTIMIZE_OUTPUT_FOR_C = YES +INPUT = ./ +INPUT_ENCODING = UTF-8 +USE_MDFILE_AS_MAINPAGE = README.md +FILE_PATTERNS = *.h \ + README.md +HTML_EXTRA_STYLESHEET = doxygen-awesome-css/doxygen-awesome.css + +RECURSIVE = YES +EXCLUDE = test doxygen-awesome-css +GENERATE_LATEX = NO +GENERATE_TREEVIEW = YES +EXAMPLE_PATTERNS = * +SOURCE_BROWSER = YES +INLINE_SIMPLE_STRUCTS = YES +EXTRACT_ALL = YES +EXTRACT_STATIC = YES +SORT_MEMBER_DOCS = NO +FULL_SIDEBAR = NO +DISABLE_INDEX = NO +INLINE_SOURCES = YES +LAYOUT_FILE = DoxygenLayout.xml +HTML_INDEX_NUM_ENTRIES = 1 diff --git a/DoxygenLayout.xml b/DoxygenLayout.xml new file mode 100644 index 0000000..740330f --- /dev/null +++ b/DoxygenLayout.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Makefile b/Makefile index 1abfd47..1a0afc0 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,10 @@ test: all ${TEST_SOURCES} lint: clang-format --Werror --dry-run ${LIB_SOURCES} ${TEST_SOURCES} ${HEADER_FILES} ./main.c +.PHONY: documentation +documentation: + doxygen ./Doxyfile + .PHONY: clean clean: - rm --recursive --force ./build ./bin *.out *.o *.exe *.a + rm --recursive --force ./build ./bin *.out *.o *.exe *.a documentation diff --git a/README.md b/README.md index 856cf16..8514ddd 100644 --- a/README.md +++ b/README.md @@ -29,11 +29,13 @@ C is a low-level programming language and we often end up reinventing the wheel - [GNU gcc](https://gcc.gnu.org/) - [GNU make](https://www.gnu.org/software/make/) - [clang-format](https://clang.llvm.org/docs/ClangFormat.html) +- [Doxygen](https://www.doxygen.nl/) For example on GNU/Linux Ubuntu: ```sh sudo apt-get install build-essential gcc make clang-format +sudo apt-get install doxygen doxygen-gui doxygen-doc graphviz ``` ## Usage @@ -43,6 +45,7 @@ make # to compile make run # to run main make test # to run unit tests make lint # to lint the code +make documentation # to generate the documentation make clean # to clean up nm ./build/libcproject.a # to see the symbols