Skip to content

Commit

Permalink
Run SDK coverage test locally for GA
Browse files Browse the repository at this point in the history
  • Loading branch information
npentrel committed Nov 3, 2023
1 parent 7d6eb6a commit 7cdb004
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/check-methods.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
name: Check Python SDK method coverage

on:
workflow_run:
workflows: [pr-deploy-and-comment]
types:
- completed
workflow_dispatch:
pull_request:

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

steps:
- name: Checkout Push/Workflow Dispatch
- name: Check out repository
uses: actions/checkout@v3
with:
submodules: true # Fetch Hugo themes
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Set up Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "latest"
extended: true

- uses: actions/setup-python@v4
with:
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 --pr ${{ github.event.number }}

- name: Build
run: make coveragetest
10 changes: 6 additions & 4 deletions .github/workflows/check_python_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


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

args = parser.parse_args()

Expand Down Expand Up @@ -191,11 +191,13 @@ def parse(type, names):


# Parse the Docs site's service page
if args.pr:
if args.local:
if type == "app" or type == "robot":
soup2 = make_soup(f"https://docs-test.viam.dev/{pr_num}/public/program/apis/{service}/")
with open(f"dist/program/apis/{service}/index.html") as fp:
soup2 = BeautifulSoup(fp, 'html.parser')
else:
soup2 = make_soup(f"https://docs-test.viam.dev/{pr_num}/public/{type}/{service}/")
with open(f"dist/{type}/{service}/index.html") as fp:
soup2 = BeautifulSoup(fp, 'html.parser')
else:
if type == "app" or type == "robot":
soup2 = make_soup(f"https://docs.viam.com/program/apis/{service}/")
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ htmltest: clean setup
hugo $(LOCAL_OPTIONS) -d dist
htmltest

coveragetest:
hugo $(LOCAL_OPTIONS) -d dist
python3 .github/workflows/check_python_methods.py --local

markdowntest:
markdownlint --config .markdownlint.yaml

Expand Down

0 comments on commit 7cdb004

Please sign in to comment.