Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
3ce272d
Add basic doxygen support
godexsoft Feb 20, 2024
be8bc7c
Add znai doc for test
godexsoft Feb 20, 2024
f3775f2
More WIP Znai stuff
godexsoft Feb 22, 2024
a9cafc6
Fix formatting
godexsoft Feb 22, 2024
22cf39f
Fix formatting in docs :D
godexsoft Feb 22, 2024
7cedc9c
Add cmake target to export Znai docs
godexsoft Feb 22, 2024
87247ad
Add workflow to generate and upload docs to gh-pages
godexsoft Feb 22, 2024
d71e9b4
Remove token forwarding
godexsoft Feb 22, 2024
e2ec3ec
Few small adjustments
godexsoft Feb 22, 2024
80fe3ae
Try to checkout with submodules
godexsoft Feb 22, 2024
01e3ecb
Fix missing target
godexsoft Feb 22, 2024
e4e1f10
Fix doxygen path
godexsoft Feb 22, 2024
d271b58
Fix path to doxygen issue and cleanup
godexsoft Feb 25, 2024
201207c
Add a few more drafted docs
godexsoft Feb 25, 2024
c634da1
Add dockerfile for ci image
godexsoft Feb 25, 2024
9c2598e
Try gh-pages deploy workflow
godexsoft Mar 17, 2024
58683de
Add permissions to workflow
godexsoft Mar 17, 2024
6c02116
Add workflow_call back
godexsoft Mar 17, 2024
5c426e7
Correct path to znai doc
godexsoft Mar 17, 2024
a76a7cc
Back to doc root
godexsoft Mar 17, 2024
39258d9
Remove docs from build, use as separate workflow only
godexsoft Mar 17, 2024
e49561f
Merge branch 'main' into feature/doxygen
godexsoft Mar 17, 2024
7ce7294
WIP
godexsoft Apr 12, 2024
070e23b
merge branch 'main' into feature/doxygen
godexsoft Apr 14, 2024
6fc0979
Merge branch 'main' into feature/doxygen
godexsoft Apr 14, 2024
1ca1286
Deploy znai doc to root
godexsoft Apr 14, 2024
78624ff
Use new ci image with znai 1.68
godexsoft Apr 14, 2024
8524792
Merge branch 'main' into feature/doxygen
godexsoft May 7, 2024
2b84e91
Switch to znai 1.69
godexsoft May 7, 2024
0c91694
Merge branch 'main' into feature/doxygen
godexsoft May 26, 2024
190d943
Small fixes after merging main
godexsoft May 26, 2024
71d2676
Add a few more files and an error to discuss
godexsoft May 26, 2024
c976495
Use latest znai and add placeholder doxy comments
godexsoft Jun 30, 2024
355491f
Use snippets from actual code
godexsoft Jul 1, 2024
e51eb02
Use lookup-paths file
godexsoft Jul 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: docs
on:
push:
branches: [main, feature/doxygen]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
generate_docs:
name: Generate and upload docs
runs-on: ubuntu-20.04
container:
image: godexsoft/functional-ci:0.0.4
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'

- name: Export docs
continue-on-error: false
shell: bash
id: run_cmake
run: |
mkdir .build
cd .build
cmake -DDOCS=True ..
cmake --build . --target export_docs

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./.build/docs

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MykolaGolubyev I have added the deploy step here, it's uploading correctly to gh-pages but there is a catch, we specify functional as the doc-id when exporting the docs and so they end up in build/docs/functional. Once i upload with gh-pages, you can see the result on https://libfn.org/functional

This is almost good but i'd like the functional docs to be at the root of libfn.org. Is that something we can do with Znai today? The problem is that znai generates all the internal links/paths as /functional/... so i can't simply put the exported pages to the root of libfn.org.
I could not find any options on Znai that would allow me to easily fix it. Please let me know if there are any 🙇‍♂️

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right. One way to "improve" it a bit is to use docs as docId (e.g. https://liftwizard.io/docs/configuration/json5-configuration)

But also wonder (haven't tried) if you pass an empty string or maybe forward slash as docId.

The reason for docId internal requirement is so urls can be treated the same way /docs/my-page and /docs/my-page/ (extra slash). Otherwise relative linking (..) would be messed up.

If you go with docs then you can imagine having blog or something like that. Not ideal trade off I understand.

Let me know if empty docId doesn't work and I will check the code to make it work.

@godexsoft godexsoft Mar 18, 2024 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestions. Trying now.

  • If i specify empty ('') or a space ( ) for doc-id, then i get Missing argument for option: doc-id
  • Completely removing -doc-id automatically sets the doc-id to no-id-specified which also is not root
  • Specifying a forward slash (/) yields an exception:
    generating the rest of HTML pages
    deploying index.md to /index.html
    Exception in thread "main" java.lang.RuntimeException: error during rendering of index: java.nio.file.AccessDeniedException: /index.html
    

Looks like this use-case is just not supported atm.
Perhaps it will be easy to fix. I like the forward slash idea. I feel like it's almost working except for the permissions 🤞

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for the docs and blog idea - that's not too bad if we ever have a blog.
But for now, I'd like Znai to have the ability to generate straight for the root path. I think this is likely going to be a common use case.. I fear it's only time before other users come with the same question to you :rage4:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please try to remove doc-id parameter altogether?

This does not appear to work. It creates the no-id-specified folder on export then.

Feel free to provide more feedback so I can pack them all together for the next release

Sorry, did not find the time to write more documentation yet. So i don't really have feedback outside of what we covered before in the discussion on this pr. 🙇

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix was released as 1.69

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have switched to the new version and it seems to do the right thing now 👍 🙇

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if you have docs deployed somewhere - I could take a look and maybe suggest a thing or two if you want.
If you have some energy left, could you please post something here - testingisdocumenting/znai#824

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MykolaGolubyev latest docs are deployed to libfn.org but we are yet to actually write the contents :rage4:

name: docs-develop

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: docs-develop
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ include(Ccache)
option(USE_NIX "Use nix packages to resolve dependencies." OFF)

option(COVERARE "Enable coverage report." OFF)
option(DOCS "Generate documentation." OFF)

if(COVERAGE)
include(CodeCoverage)
include(Coverage)
endif()

if (DOCS)
include(Docs)
endif()

set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
23 changes: 23 additions & 0 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM fedora:39

WORKDIR /root

RUN dnf -y update ;\
dnf -y install redhat-lsb python3.11 gcc libstdc++-static ccache \
vim wget sudo curl git grep sed gdb zsh cmake doxygen ninja-build \
unzip java-latest-openjdk clang git-clang-format clang-tools-extra llvm ;\
dnf -y clean all

# Fail build if unexpected gcc version
RUN gcc --version | grep -E "^gcc \(GCC\) 13"

RUN wget https://repo.maven.apache.org/maven2/org/testingisdocumenting/znai/znai-dist/1.70/znai-dist-1.70-znai.zip ;\
unzip znai-dist-1.70-znai.zip -d znai_tmp; mv znai_tmp/dist /opt/znai ;\
rm -rf znai-dist-1.70-znai.zip znai_tmp
ENV PATH=/opt/znai:${PATH}

ENV CC=/usr/bin/gcc
ENV CXX=/usr/bin/g++
ENV CMAKE_GENERATOR='Ninja'
ENV CMAKE_C_COMPILER=${CC}
ENV CMAKE_CXX_COMPILER=${CXX}
Empty file.
27 changes: 27 additions & 0 deletions cmake/Docs.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
find_package(Doxygen REQUIRED)
Comment thread
godexsoft marked this conversation as resolved.
Resolved
find_package(Znai REQUIRED)

set(DOXYGEN_GENERATE_HTML NO)
set(DOXYGEN_GENERATE_XML YES)

macro(znai_export_docs TARGET SOURCE_DIR DEPLOY_DIR)
add_custom_target(${TARGET}
COMMAND ${Znai} --source ${SOURCE_DIR} --deploy ${DEPLOY_DIR} --doc-id '""' --lookup-paths ${CMAKE_BINARY_DIR}
COMMENT "Exporting documentation to ${DEPLOY_DIR}"
)
endmacro()

doxygen_add_docs(
docs
${CMAKE_CURRENT_SOURCE_DIR}/include
COMMENT "Generate documentation"
)

znai_export_docs(
export_docs
${CMAKE_CURRENT_SOURCE_DIR}/docs
${CMAKE_BINARY_DIR}/docs
COMMENT "Export final documentation"
)

add_dependencies(export_docs docs)
4 changes: 4 additions & 0 deletions cmake/FindZnai.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
find_program (Znai NAMES znai)
if(Znai_FOUND)
message(STATUS "Znai found at ${Znai}")
endif()
15 changes: 15 additions & 0 deletions docs/choice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: fn::choice
---

##### Defined in {style: "api", badge: "#include <functional/choice.hpp>"}

---

:include-doxygen-doc: fn::choice

---

## Return value {style: "api"}
TODO

28 changes: 28 additions & 0 deletions docs/choice/and_then.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: fn::and_then
---

##### Defined in {style: "api", badge: "#include <functional/and_then.hpp>"}

---

:include-doxygen-doc: fn::and_then_t

---

## Call signatures {style: "api"}
:include-doxygen-member: fn::and_then_t::operator() { signatureOnly: false, includeAllMatches: true }

---

## Return value {style: "api"}
A monadic type of the same kind.

---

## Examples {style: "api"}

:include-template: templates/snippet.md {
path: "examples/simple.cpp",
surroundedBy: ["// example-choice-parse", "// example-choice-checks"]
}
28 changes: 28 additions & 0 deletions docs/choice/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: Choice monad
---

##### Defined in {style: "api", badge: "#include <functional/choice.hpp>"}

---

:include-doxygen-doc: fn::choice

## choice_for {style: "api"}
Used to generate `fn::choice` correctly. Sorts and deduplicates types under the hood.

Some text explaining this section...

:include-doxygen-member: fn::choice_for { signatureOnly: false, includeAllMatches: true }

## choice {style: "api"}
Some text explaining this section...

:include-doxygen-member: fn::choice { signatureOnly: false, includeAllMatches: true }

## value {style: "api"}
Some text explaining this section...

:include-doxygen-member: fn::choice< Ts... >::value { signatureOnly: false, includeAllMatches: true }


19 changes: 19 additions & 0 deletions docs/choice/transform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: fn::transform
---

##### Defined in {style: "api", badge: "#include <functional/transform.hpp>"}

---

:include-doxygen-doc: fn::transform_t

---

## Call signatures {style: "api"}
:include-doxygen-member: fn::transform_t::operator() { signatureOnly: false, includeAllMatches: true }

---

## Return value {style: "api"}
A monadic type of the same kind.
3 changes: 3 additions & 0 deletions docs/doxygen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"indexPath": "xml/index.xml"
}
35 changes: 35 additions & 0 deletions docs/expected/and_then.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: fn::and_then
---

##### Defined in {style: "api", badge: "#include <functional/and_then.hpp>"}

---

:include-doxygen-doc: fn::and_then_t

---

## Call signatures {style: "api"}
:include-doxygen-member: fn::and_then_t::operator() { signatureOnly: false, includeAllMatches: true }

---

## Return value {style: "api"}
A monadic type of the same kind.

---

## Examples {style: "api"}

:include-template: templates/snippet.md {
path: "examples/simple.cpp",
surroundedBy: ["// example-error-struct", "// example-expected-and_then-value"],
desc: "The resulting value is `13` because `ex` does not contain an `Error` and therefore `and_then` is called."
}

:include-template: templates/snippet.md {
path: "examples/simple.cpp",
surroundedBy: ["// example-error-struct", "// example-expected-and_then-error"],
desc: "The result is an `Error` because `ex` already contained an `Error` and therefore `and_then` is not called."
}
20 changes: 20 additions & 0 deletions docs/expected/fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: fn::fail
---

##### Defined in {style: "api", badge: "#include <functional/fail.hpp>"}

---

:include-doxygen-doc: fn::fail_t

---

## Call signatures {style: "api"}
:include-doxygen-member: fn::fail_t::operator() { signatureOnly: false, includeAllMatches: true }

---

## Return value {style: "api"}
A monadic type of the same kind.

35 changes: 35 additions & 0 deletions docs/expected/filter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: fn::filter
---

##### Defined in {style: "api", badge: "#include <functional/filter.hpp>"}

---

:include-doxygen-doc: fn::filter_t

---

## Call signatures {style: "api"}
:include-doxygen-member: fn::filter_t::operator() { signatureOnly: false, includeAllMatches: true }

---

## Return value {style: "api"}
A monadic type of the same kind.

---

## Examples {style: "api"}

:include-template: templates/snippet.md {
path: "examples/simple.cpp",
surroundedBy: ["// example-error-struct", "// example-expected-filter-value"],
desc: "The resulting value is `42` because the filter predicate returns `true` for `42` as it is not less than `42`."
}

:include-template: templates/snippet.md {
path: "examples/simple.cpp",
surroundedBy: ["// example-error-struct", "// example-expected-filter-error"],
desc: "The error is set to `Less than 42` because the predicate returns `false` for `12` since it's less than `42`."
}
19 changes: 19 additions & 0 deletions docs/expected/inspect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: fn::inspect
---

##### Defined in {style: "api", badge: "#include <functional/inspect.hpp>"}

---

:include-doxygen-doc: fn::inspect_t

---

## Call signatures {style: "api"}
:include-doxygen-member: fn::inspect_t::operator() { signatureOnly: false, includeAllMatches: true }

---

## Return value {style: "api"}
A monadic type of the same kind.
20 changes: 20 additions & 0 deletions docs/expected/inspect_error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: fn::inspect_error
---

##### Defined in {style: "api", badge: "#include <functional/inspect_error.hpp>"}

---

:include-doxygen-doc: fn::inspect_error_t

---

## Call signatures {style: "api"}
:include-doxygen-member: fn::inspect_error_t::operator() { signatureOnly: false, includeAllMatches: true }

---

## Return value {style: "api"}
A monadic type of the same kind.

19 changes: 19 additions & 0 deletions docs/expected/or_else.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: fn::or_else
---

##### Defined in {style: "api", badge: "#include <functional/or_else.hpp>"}

---

:include-doxygen-doc: fn::or_else_t

---

## Call signatures {style: "api"}
:include-doxygen-member: fn::or_else_t::operator() { signatureOnly: false, includeAllMatches: true }

---

## Return value {style: "api"}
A monadic type of the same kind.
19 changes: 19 additions & 0 deletions docs/expected/recover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: fn::recover
---

##### Defined in {style: "api", badge: "#include <functional/recover.hpp>"}

---

:include-doxygen-doc: fn::recover_t

---

## Call signatures {style: "api"}
:include-doxygen-member: fn::recover_t::operator() { signatureOnly: false, includeAllMatches: true }

---

## Return value {style: "api"}
A monadic type of the same kind.
Loading