Add ReadTheDocs configuration file #69
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-test: | |
name: "Build and Test Python 3.9" | |
runs-on: ubuntu-latest | |
if: always() | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
cache: "pip" | |
- name: Install Dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pytest-github-actions-annotate-failures | |
- name: Download NLTK dependencies | |
run: | | |
python -m nltk.downloader punkt wordnet stopwords omw-1.4 | |
- name: PyTest with code coverage | |
continue-on-error: true | |
run: | | |
pytest --cov=. --cov-report=term-missing --cov-report=xml --cov-branch | |
- name: Get the Coverage | |
shell: bash | |
run: | | |
regex='<coverage.+line-rate="([0-9).[0-9]+)".+>' | |
line=$(grep -oP $regex coverage.xml) | |
[[ $line =~ $regex ]] | |
coverage=$( bc <<< ${BASH_REMATCH[1]}*100 ) | |
if (( $(echo "$coverage > 90" |bc -l) )); then | |
COLOR=green | |
else | |
COLOR=red | |
fi | |
echo "COVERAGE=${coverage%.*}%" >> $GITHUB_ENV | |
echo "COLOR=$COLOR" >> $GITHUB_ENV | |
- name: Create the Badge | |
uses: schneegans/dynamic-badges-action@v1.6.0 | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 4f783c1a3358dbd1e01d44f9656676a0 | |
filename: coverage.${{ github.event.repository.name }}.main.json | |
label: coverage | |
message: ${{ env.COVERAGE }} | |
color: ${{ env.COLOR }} |