Skip to content

Generate api docs for EESSI test suite #319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
30b717a
generate api docs
xinan1911 Oct 10, 2024
3fdb896
Update deploy.yml and schedule
xinan1911 Oct 11, 2024
80f2c3a
Update deploy.yml syntax
xinan1911 Oct 11, 2024
5c7ef65
Update test.yml
xinan1911 Oct 11, 2024
65131b8
Update deploy.yml for action version
xinan1911 Oct 14, 2024
1994da4
Update test.yml
xinan1911 Oct 14, 2024
33762ff
Update deploy.yml resolve failed build
xinan1911 Oct 14, 2024
0004eb3
Update test.yml resolve failed build
xinan1911 Oct 14, 2024
12dc637
Update test.yml actions/setup-python@v5
xinan1911 Oct 14, 2024
9ca30ae
Moved location of testsuite API docs, as well as subdir
Apr 28, 2025
170da31
Resolved conflicts with upstream
Apr 28, 2025
9a027b2
Don't clone into src subdir, the subdir will already be test-suite, t…
Apr 28, 2025
422a20e
Put back EESSI in CI section, it was unintendely removed in this feat…
Apr 28, 2025
dd28578
Also remove the subdir for the checkout of EESSI test-suite in the te…
Apr 28, 2025
b870f15
Expand update_generated_time functionality so that we may reuse it in…
Apr 28, 2025
0d242ef
Make this a manual action
Apr 28, 2025
a99c6db
Restore original deploy.yml
Apr 28, 2025
322d0d4
.github/workflows/test.yml
Apr 28, 2025
1e31fd7
Simplify gen_ref_pages by removing commented code and documenting the…
Apr 28, 2025
e1ab323
Cleaned up code for automatically generating docs with mkdocs for EES…
Apr 28, 2025
51c3d48
Now really do it only on manual trigger
Apr 28, 2025
15ff385
Fix codespell issue
Apr 28, 2025
2aae108
Specify dedicated checkout path for cloning the testsuite repo
Apr 28, 2025
6726d44
Checking in test-suite path, otherwise the checkout overwrite any pre…
Apr 28, 2025
7d3189f
Makre sure te summary MD is also written to testsuite_api
Apr 29, 2025
af73133
Fix cross reference
Apr 29, 2025
09a7a5f
Change deployment strategy, as the autogenerated API docs end up dire…
Apr 29, 2025
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
20 changes: 20 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: deploy documentation (only on push to main branch)
on:
push:
branches: main
# Add option to deploy manually, e.g. because there is a new EESSI test suite release and we want updated API docs
workflow_dispatch:
# Declare default permissions as read only.
permissions: read-all
jobs:
Expand All @@ -28,5 +30,23 @@ jobs:
pip list | grep mkdocs
mkdocs --version

# Make sure to also deploy auto-generated API docs for test suite
# For that, we need the repo to be available under eessi/test-suite
- name: checkout test suite
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
with:
repository: eessi/test-suite
# Path is needed, otherwise this will overwrite the checkout action that cloned the docs repo
path: test-suite
# Make sure to fetch tags, so we can checkout a particular release
fetch-tags: True
# Generate docs for latest release
run: |
cd eessi/tests-suite
# This assumes we stick to a version-tagging scheme vX.Y.Z
LATEST_VERSION=$(git tag | grep '^v[0-9]\+\.[0-9]\+\.[0-9]\+$' | sort -t. -k 1,1n -k 2,2n -k 3,3n | tail -1)
# Use the latest release by default
git checkout $LATEST_VERSION

- name: build tutorial
run: make test && make deploy
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,25 @@ jobs:
# config: '/lint/config/changelog.yml'
# args: '.'


# Make sure to also test deployment of auto-generated API docs for test suite
# For that, we need the repo to be available under eessi/test-suite
- name: checkout test suite
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
with:
repository: eessi/test-suite
# Path is needed, otherwise this will overwrite the checkout action that cloned the docs repo
path: test-suite
# Make sure to fetch tags, so we can checkout a particular release
fetch-tags: True
# Generate docs for latest release
run: |
cd eessi/tests-suite
# This assumes we stick to a version-tagging scheme vX.Y.Z
LATEST_VERSION=$(git tag | grep '^v[0-9]\+\.[0-9]\+\.[0-9]\+$' | sort -t. -k 1,1n -k 2,2n -k 3,3n | tail -1)
# Use the latest release by default
git checkout $LATEST_VERSION

- name: install mkdocs + plugins
run: |
pip install -r requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion docs/adding_software/debugging_failed_builds.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ eb --easystack eessi-2023.06-eb-4.8.1-2021b.yml --robot
After some time, this build fails while trying to build `Plumed`, and we can access the build log to look for clues on why it failed.

## Building an individual package
First, prepare the environment by following the [Starting the EESSI software environment][#starting-the-eessi-software-environment] and [Configure EasyBuild](#configure-easybuild) above.
First, prepare the environment by following the [Starting the EESSI software environment](#starting-the-eessi-software-environment) and [Configure EasyBuild](#configure-easybuild) above.

In our [example PR](https://github.com/EESSI/software-layer/pull/360), the individual package that was added to `eessi-2023.06-eb-4.8.1-2021b.yml` was `LAMMPS-23Jun2022-foss-2021b-kokkos.eb`. To mimic the build behaviour, we'll also have to (re)use any options that are listed in the easystack file for `LAMMPS-23Jun2022-foss-2021b-kokkos.eb`, in this case the option `--from-pr 19000`. Thus, to build, we run:
```
Expand Down
50 changes: 50 additions & 0 deletions docs/generate_eessi_testsuite_api_docs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""
Generate the code reference pages.
Based off https://mkdocstrings.github.io/recipes/#automatic-code-reference-pages
"""

from pathlib import Path

import mkdocs_gen_files

TEST_SUITE = "test-suite/test-suite"

# build a navigation for the menu and a dictionary of navigations for each section
nav = mkdocs_gen_files.Nav()

# Loop through all python files in test-suite/eessi
for path in sorted(Path(f"{TEST_SUITE}/eessi/").rglob("*.py")):
# Get the relative filename, without .py suffix
module_path = path.relative_to(TEST_SUITE).with_suffix("")

# define the corresponding (relative) markdown filename
doc_path = path.relative_to(TEST_SUITE).with_suffix(".md")

# Specify the full corresponding markdown filename, including a testsuite_api subdir
# so that we don't have these API docs scattered in the root of the EESSI docs repo
full_doc_path = Path("testsuite_api/", doc_path)

# If something is an __init__, use the directory name as the name of the python module instead of the filename
parts = list(module_path.parts)
if parts[-1] == "__init__":
parts = parts[:-1]
# Skip the __main__, if there is one. This is not part of the API
elif parts[-1] == "__main__":
continue

# Add an entry for this module to the navigation
nav[parts] = doc_path.as_posix()

# Create the markdown file
with mkdocs_gen_files.open(full_doc_path, "w") as fd:
# identifier is something like eessi.foo.bar
identifier = ".".join(parts)
fd.write(f"::: {identifier}")

# This maps the generated .md file to the source .py, so that you can have an "Edit on GitHub" button
# that links to the Python code
mkdocs_gen_files.set_edit_path(full_doc_path, path)

# Create the api/summary.md file and write the full navigation tree into it so it can be used as a site sidebar
with mkdocs_gen_files.open("testsuite_api/summary.md", "w") as nav_file:
nav_file.writelines(nav.build_literate_nav())
19 changes: 19 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ nav:
- Available tests: test-suite/available-tests.md
- Writing tests: test-suite/writing-portable-tests.md
- Release notes: test-suite/release-notes.md
- API documentation: testsuite_api/
- Known issues and workarounds:
- v2023.06: known_issues/eessi-2023.06.md
- Adding software to EESSI:
Expand Down Expand Up @@ -103,6 +104,24 @@ plugins:
gpu.md: site_specific_config/gpu.md
# Enable our custom plugin for json-ld metadata
- inject_ld_json
# link to any Markdown heading
- autorefs
# api automatics documentation
- mkdocstrings:
default_handler: python
handlers:
python:
paths: [test-suite/test-suite]
options:
docstring_style: sphinx
docstring_section_style: spacy
show_source: false
- gen-files:
scripts:
- docs/generate_eessi_testsuite_api_docs.py
- literate-nav:
nav_file: summary.md
- section-index
markdown_extensions:
# enable adding HTML attributes and CSS classes
- attr_list
Expand Down
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ mkdocs-git-revision-date-localized-plugin
mkdocs-toc-sidebar-plugin
mkdocs-macros-plugin
./mkdocs-ldjson-plugin
mkdocs-autorefs
mkdocstrings[python]
mkdocs-gen-files
mkdocs-literate-nav
mkdocs-section-index