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

Run SDK coverage test locally for GA #2156

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading