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

Feature/gha tests dependency caching #102

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
42 changes: 34 additions & 8 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,46 @@ jobs:

steps:

- uses: actions/setup-python@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- run: python -m pip install --upgrade pip

- uses: actions/checkout@v2
- name: Upgrade pip
run: python -m pip install --upgrade pip

- run: python -m pip install .[test,docs]
- name: Checkout code
uses: actions/checkout@v2

- run: python -m pytest ./testing/ --cov=idelib --cov-report=xml -n auto
- run: sphinx-build -W -b html docs docs/html
- run: sphinx-build -W -b doctest docs docs/doctest
- name: Get pip Cache Location
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"

- uses: codecov/codecov-action@v2
- name: Get Date
id: get-date
run: echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
shell: bash

- name: Setup pip Cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ steps.get-date.outputs.date }}-pip-${{ hashFiles('**/setup.py') }}

- name: Install package & (test) dependencies
run: python -m pip install .[test,docs]

- name: Run Unit Tests
run: python -m pytest ./testing/ --cov=idelib --cov-report=xml -n auto

- name: Run Docs test
run: sphinx-build -W -b html ./docs/source ./docs/html

- name: Run Docstring Tests
run: sphinx-build -W -b doctest ./docs/source ./docs/doctest

- name: Generate Codecov Report
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS,PYTHON-VERSION
Expand Down