Skip to content

Commit

Permalink
Add sanity check CI (#17)
Browse files Browse the repository at this point in the history
* Add sanity check CI

* Check for help mesage rather than no arguments

* Minor re-organization to prevent error code exit
  • Loading branch information
nicovank authored Sep 30, 2023
1 parent 2b39b22 commit 563c2c8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/sanity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Sanity

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
sanity:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Update pip
run: python3 -m pip install --upgrade pip

- name: Install
run: python3 -m pip install .

- name: Install in editable mode
run: python3 -m pip install -e .

- name: Check help message
run: python3 -m chatdbg --help
8 changes: 4 additions & 4 deletions src/chatdbg/chatdbg.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ def main():

opts, args = getopt.getopt(sys.argv[1:], "mhc:", ["help", "command="])

if not args:
print(_usage)
sys.exit(2)

if any(opt in ["-h", "--help"] for opt, optarg in opts):
print(_usage)
sys.exit()

if not args:
print(_usage)
sys.exit(2)

commands = [optarg for opt, optarg in opts if opt in ["-c", "--command"]]

module_indicated = any(opt in ["-m"] for opt, optarg in opts)
Expand Down

0 comments on commit 563c2c8

Please sign in to comment.