Skip to content
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

Adding workflow to create Cordio platform docs. #403

Closed
wants to merge 66 commits into from
Closed
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
49c16ab
Moving existing documents.
kevin-gillespie Dec 2, 2022
12d3122
Fixing path for buildable projects.
kevin-gillespie Dec 2, 2022
d13c4ed
Adding new README shell.
kevin-gillespie Dec 2, 2022
9a5084e
Adding outline for docs.
kevin-gillespie Dec 2, 2022
b22ebc1
Refining links.
kevin-gillespie Dec 2, 2022
359ffcc
Adding additional applications.
kevin-gillespie Dec 2, 2022
10b76ce
Adding content to BLUETOOTH_LE_BASICS
kevin-gillespie Dec 2, 2022
eca528e
Adding feature support.
kevin-gillespie Dec 5, 2022
da9e4d1
Adding OTA feature details.
kevin-gillespie Dec 5, 2022
d619936
Moving datc/dats documentation.
kevin-gillespie Dec 6, 2022
2193526
Linking BLE_datc/dats README
kevin-gillespie Dec 6, 2022
bb9c3e5
Adding architecture docs.
kevin-gillespie Dec 7, 2022
0612138
Adding information on the BLE states.
kevin-gillespie Jan 10, 2023
0ab3d8e
Adding profiles and services.
kevin-gillespie Jan 10, 2023
dad8a39
Adding details on advertising.
kevin-gillespie Jan 10, 2023
88e6e3f
Adding workflow to create Cordio platform docs.
AbbyWolf-ADI Feb 10, 2023
463c252
Fixing indent.
AbbyWolf-ADI Feb 10, 2023
e1f65cc
Fixed indent.
AbbyWolf-ADI Feb 10, 2023
c5b5389
fixing indent
AbbyWolf-ADI Feb 10, 2023
e33336a
Add files via upload
AbbyWolf-ADI Feb 10, 2023
86e4ea4
testing branch (removing edits after)
AbbyWolf-ADI Feb 10, 2023
734f2c4
testing workflow
AbbyWolf-ADI Feb 10, 2023
37b06d4
fixing paths
AbbyWolf-ADI Feb 10, 2023
ed7c8f5
fixing paths
AbbyWolf-ADI Feb 10, 2023
b975c8e
debugging
AbbyWolf-ADI Feb 10, 2023
e2f69c3
updating command permissions
AbbyWolf-ADI Feb 10, 2023
906504c
update host software
AbbyWolf-ADI Feb 13, 2023
de1af34
adding latex support
AbbyWolf-ADI Feb 13, 2023
85b6ed5
create filepath for documentation
AbbyWolf-ADI Feb 13, 2023
db5cb6b
removing unnecessary cleanup
AbbyWolf-ADI Feb 13, 2023
02cf2bf
remove extra directory
AbbyWolf-ADI Feb 13, 2023
fa1ef84
update pdf save process
AbbyWolf-ADI Feb 13, 2023
2f5fa48
add push for generated documentation
AbbyWolf-ADI Feb 13, 2023
f50d42c
fix push command
AbbyWolf-ADI Feb 13, 2023
a2a5b20
Update documentation.
AbbyWolf-ADI Feb 13, 2023
39b1038
update doxyfile
AbbyWolf-ADI Feb 13, 2023
0f46361
update to get branch info
AbbyWolf-ADI Feb 13, 2023
f325aa3
automate branch selection
AbbyWolf-ADI Feb 13, 2023
8a8a6fd
Fix mkdir error
AbbyWolf-ADI Feb 13, 2023
df93989
Update documentation.
AbbyWolf-ADI Feb 13, 2023
88f839e
Update doxyfile paths
AbbyWolf-ADI Feb 13, 2023
19d5212
Update documentation.
AbbyWolf-ADI Feb 13, 2023
9de0369
Remove run condition
AbbyWolf-ADI Feb 13, 2023
3b071e9
Remove unused interfaces
AbbyWolf-ADI Feb 13, 2023
001c921
Update for use with all platform interfaces
AbbyWolf-ADI Feb 13, 2023
8a15065
Update paths to reflect doxyfile changes
AbbyWolf-ADI Feb 13, 2023
90d139b
Add names to anonymous enums
AbbyWolf-ADI Feb 13, 2023
de1cba9
Update grouping
AbbyWolf-ADI Feb 13, 2023
e23acda
Add names to anonymous enums
AbbyWolf-ADI Feb 13, 2023
6dca17d
Add names to anonymous enums
AbbyWolf-ADI Feb 13, 2023
a6ce51f
Remove unused enum from docs
AbbyWolf-ADI Feb 13, 2023
b6131eb
Update branch and fix merge conflicts
AbbyWolf-ADI Feb 21, 2023
08d314b
Update files to work with modified workflow
AbbyWolf-ADI Feb 21, 2023
4571101
Update workflow to accodate Cordio documentation
AbbyWolf-ADI Feb 21, 2023
ac70b71
Merge branch 'cordio-docs' into cordio-platform-docs
AbbyWolf-ADI Feb 22, 2023
a839525
Add functionality for automatic Cordio docs updates to USERGUIDE.md
AbbyWolf-ADI Feb 22, 2023
9d1fa5c
Change output pdf name
AbbyWolf-ADI Feb 22, 2023
635a4cb
Updated file name for current Cordio platform docs file
AbbyWolf-ADI Feb 23, 2023
12b7b3e
Move updateUSERGUIDE-Cordio.py to workflow directory
AbbyWolf-ADI Feb 23, 2023
9d122eb
Add full path to Cordio documentation in userguide links
AbbyWolf-ADI Feb 23, 2023
501a0e5
Remove incorrect pathing to Cordio docs
AbbyWolf-ADI Feb 23, 2023
1c45b98
Remove copy Cordio documentation files
AbbyWolf-ADI Feb 23, 2023
b5456a0
Move updateUSERGUIDE-Cordio.py to scripts
AbbyWolf-ADI Feb 23, 2023
65fda10
Update Cordio documentation paths
AbbyWolf-ADI Feb 23, 2023
1c8d339
Fix documentation paths
AbbyWolf-ADI Feb 23, 2023
0b169d0
Relocate and update USERGUIDE.md relative links
AbbyWolf-ADI Feb 23, 2023
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
60 changes: 60 additions & 0 deletions .github/workflows/build-cordio-platform-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build & Deploy Cordio Platform Docs

on:
workflow_dispatch:


jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v3
id: get-pr
with:
script: |
const request = {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
}
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`)
try {
const result = await github.pulls.get(request)
return result.data
} catch (err) {
core.setFailed(`Request failed with error ${err}`)
}
- uses: actions/checkout@v3
with:
repository: ${{ fromJSON(steps.get-pr.outputs.result).head.repo.full_name }}
ref: ${{ fromJSON(steps.get-pr.outputs.result).head.ref }}
fetch-depth: 0

- name: Generate Docs (MAX32655)
uses: mattnotmitt/[email protected]
with:
working-directory: Libraries/Cordio/docs
doxyfile-path: cordio_platform_doxyfile
enable-latex: true

- name: Build PDF
run: |
echo "Building PDF..."
sudo apt-get install texlive-full
sudo make -C Libraries/Cordio/docs/latex

echo "Copying PDF to Cordio/platform/Documentation"
sudo mv Libraries/Cordio/docs/latex/refman.pdf Libraries/Cordio/docs/latex/Cordio-Platform-Documentation.pdf
Copy link
Contributor

Choose a reason for hiding this comment

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

This filename looks okay, we just need to update what's currently in the PR.

sudo mkdir -p Libraries/Cordio/platform/Documentation && sudo cp -r Libraries/Cordio/docs/latex/Cordio-Platform-Documentation.pdf Libraries/Cordio/platform/Documentation/


- name: Push Documentation Files
uses: EndBug/[email protected]
with:
add: 'Libraries/Cordio/platform/Documentation/Platform_ref.pdf'
message: 'Update documentation.'
push: true




6 changes: 6 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ jobs:

echo "Copying any root markdown files into Documentation..."
cp -r *.md Documentation/
echo "Copying any Cordio markdown files into Documentation..."
cp -r Libraries/Cordio/docs/*.md Documentation/
cp -r Libraries/Cordio/docs/res/* Documentation/res/
cp -r Libraries/Cordio/platform/Documentation/*.pdf Documentation/

python3 Documentation/updateUSERGUIDE-Cordio.py

mkdocs build

Expand Down
7 changes: 7 additions & 0 deletions Documentation/USERGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1584,6 +1584,12 @@ The Cordio Bluetooth Low Energy (BLE) library provides a full BLE stack for micr
- MAX32680
- MAX32690

#### Cordio Documentation

- [Architecture](ARCHITECTURE.md)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we'll have to add a path for these links to work.

Copy link
Contributor Author

@AbbyWolf-ADI AbbyWolf-ADI Feb 23, 2023

Choose a reason for hiding this comment

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

tested it a couple different times on my machine, since the workflow copies those files in the same directory as the userguide.md file , pathing like this works fine

Copy link
Contributor

Choose a reason for hiding this comment

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

If we look at this file in the main branch then the path will be wrong. I don't think we should permanently copy the markdown files into this directory.

- [Bluetooth LE Basics](BLUETOOTH_LE_BASICS.md)
- [Packetcraft](PACKETCRAFT.md)

---

### MAXUSB
Expand Down Expand Up @@ -1617,3 +1623,4 @@ The **Secure Digital High Capacity *(SDHC)*** library offers a higher-level inte
- MAX32570
- MAX32665-MAX32668
- MAX78002

67 changes: 67 additions & 0 deletions Documentation/updateUSERGUIDE-Cordio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
from pathlib import Path
from os import listdir

Copy link
Contributor

Choose a reason for hiding this comment

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

So this looks for markdown files and PDFs and adds links to USERGUIDE.md?

Maybe we should move this to the workflows folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved, but we will have to do a test to double check the new pathing from that file


TEMPLATE = "- [%s](%s)\n"
here = Path.cwd()
repo = here.parent
cordio_docs_dir = repo / "Libraries" / "Cordio" / "docs"
platform_docs_dir = repo / "Libraries" / "Cordio" / "platform" / "Documentation"

cordio_doc_files = [f for f in listdir(cordio_docs_dir) if f.endswith('.md')]
platform_doc_files = [f for f in listdir(platform_docs_dir) if f.endswith('.pdf')]

with open('USERGUIDE.md', 'r') as f:
lines = f.readlines()

idx = 0
foundStart = False

for line in lines:
if foundStart:
if line[0] == '#':
end_idx = idx
break

if '#### Cordio Documentation' in line:
start_idx = idx
foundStart = True

idx += 1

comp_lines = lines[start_idx+1:end_idx]
new_files = cordio_doc_files + platform_doc_files

for cfile in cordio_doc_files:
for line in lines:
if cfile in line:
new_files.remove(cfile)

for pfile in platform_doc_files:
for line in lines:
if pfile in line:
new_files.remove(pfile)

if len(new_files) > 0:
entries = []
for f in new_files:
if 'LICENSE' in f:
continue
nav_name = f.split('.')[0].title()
entries.append(TEMPLATE % (nav_name, f))

while True:
if lines[end_idx][0] == '-':
end_idx -= 1
break
end_idx -= 1

idx = 0
for entry in entries:
lines.insert(end_idx, entry)
end_idx += 1

content = "".join(lines)

with open('USERGUIDE.md', 'w') as f:
f.write(content)
Loading