Skip to content

Commit

Permalink
Compare SDK methods to staged PR (#2146)
Browse files Browse the repository at this point in the history
  • Loading branch information
npentrel authored Nov 2, 2023
1 parent 73d5a57 commit 2fe3eed
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/check-methods.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Check Python SDK method coverage

# This action works with pull requests and pushes
on:
workflow_run:
workflows: ["pr-deploy-and-comment"]
branches: [main]
types:
- completed
on:
pull_request:
push:
Expand All @@ -9,6 +15,7 @@ on:

jobs:
python-methods:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
continue-on-error: true

Expand All @@ -17,8 +24,8 @@ jobs:
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip' # caching pip dependencies
- run: pip install beautifulsoup4 markdownify
python-version: "3.9"
cache: "pip" # caching pip dependencies
- run: pip install beautifulsoup4 markdownify argparse
- name: "Check Python SDK method coverage"
run: python3 .github/workflows/check_python_methods.py
run: python3 .github/workflows/check_python_methods.py --pr ${{ github.event.number }}
18 changes: 15 additions & 3 deletions .github/workflows/check_python_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
import sys
import markdownify
import urllib.parse
import argparse


parser = argparse.ArgumentParser()
parser.add_argument('--pr', type=str, required=False)

args = parser.parse_args()

services = ["motion", "navigation", "sensors", "slam", "vision", "mlmodel"]
components = ["arm", "base", "board", "camera", "encoder", "gantry", "generic", "gripper",
"input", "movement_sensor", "power_sensor", "sensor"]
Expand Down Expand Up @@ -185,10 +191,16 @@ def parse(type, names):


# Parse the Docs site's service page
if type == "app" or type == "robot":
soup2 = make_soup(f"https://docs.viam.com/program/apis/{service}/")
if args.pr:
if type == "app" or type == "robot":
soup2 = make_soup(f"https://docs-test.viam.dev/{pr_num}/public/program/apis/{service}/")
else:
soup2 = make_soup(f"https://docs-test.viam.dev/{pr_num}/public/{type}/{service}/")
else:
soup2 = make_soup(f"https://docs.viam.com/{type}/{service}/")
if type == "app" or type == "robot":
soup2 = make_soup(f"https://docs.viam.com/program/apis/{service}/")
else:
soup2 = make_soup(f"https://docs.viam.com/{type}/{service}/")

# Find all links on Docs site soup
all_links = soup2.find_all('a')
Expand Down

0 comments on commit 2fe3eed

Please sign in to comment.