adding poetry and caching to actions build

This commit is contained in:
Patrick Daly 2021-07-26 17:58:43 -07:00
parent 879e56ac92
commit 278a75caed

View File

@ -4,22 +4,55 @@ on: [push, pull_request]
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Python 3.9 - name: Set up Python 3.9
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: 3.9 python-version: 3.9
- name: Install dependencies
- name: Get full Python version
id: full-python-version
shell: bash
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
- name: Bootstrap poetry
shell: bash
run: | run: |
python -m pip install --upgrade pip curl -sL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py \
pip install -r requirements.txt | python - -y
pip install -r requirements_dev.txt
- name: Update PATH
if: ${{ matrix.os != 'Windows' }}
shell: bash
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Configure poetry
shell: bash
run: poetry config virtualenvs.in-project true
- name: Set up cache
uses: actions/cache@v2
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
shell: bash
run: timeout 10s poetry run pip --version || rm -rf .venv
- name: Install dependencies
shell: bash
run: poetry install
- name: Run precommit - name: Run precommit
run: | run: |
pre-commit run --all-files pre-commit run --all-files
- name: Test with unittest
run: | - name: Test with pytest
python -m unittest tests/*.py shell: bash
run: poetry run test