Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Automatic docs build #45

Closed
wants to merge 6 commits into from
Closed
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
48 changes: 48 additions & 0 deletions .github/workflows/docs-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: docs-build
on :
pull_request:
paths:
- "mcat/*.py"

jobs:
docs-build:
name: Docs build
runs-on: ubuntu-latest
env:
# see tox.ini
TOXENV: docs

steps:
- name: Checkout repository code
uses: actions/checkout@v2

- name: Setup python
uses: actions/setup-python@v2
with:
python-version: 3.x

- name: Install python packages
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox

- name: Run tox (${{ env.TOXENV }})
run: tox

- name: Get git status
id: git_status
run: |
if [ $(git status --porcelain) == "" ]; then
echo ::set-output name=uncommitted::false
else
echo ::set-output name=uncommitted::true
fi

- name: Check for uncommited docs
if: ${{steps.git_status.outputs.uncommitted}}
run: |
echo "Uncommitted docs found. Faliing the job."
exit 1



8 changes: 7 additions & 1 deletion .github/workflows/github-actions-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: test
on : [pull_request, push]

on:
push:
branches:
- main
pull_request:

jobs:
mcat-action-test:
strategy:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Auto-generated API documentation can be found in
Run the following command to update the API documentation

```python
PYTHONPATH=./mcat pdoc --html --output-dir docs mcat
tox -e docs
```

## Blog Posts
Expand Down
1 change: 1 addition & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="refresh" content="0; url=./mcat/index.html" />
1 change: 1 addition & 0 deletions mcat/commentAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def __init__(self, words):
"""
Constructors form a dictionary to be used for counting.
Parameters: words - list of words to count
Test docs
"""
self.word_count = {word.lower(): 0 for word in words} # Create dictionary with list items as key
self.vader_sentiment = vader.SentimentIntensityAnalyzer() # Initialize sentiment analysis model
Expand Down
12 changes: 9 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@
# and then run "tox" from this directory.

[tox]
envlist = py
envlist = py, docs
skipsdist=True

[testenv]
changedir =
{toxinidir}
changedir = {toxinidir}
deps =
-r{toxinidir}/requirements.txt

commands =
python -m unittest discover -s tests

[testenv:docs]
changedir = {toxinidir}
allowlist_externals = /bin/sh
/usr/bin/sh
commands =
sh -c 'PYTHONPATH=./mcat pdoc --force --html --output-dir docs mcat'