Skip to content

Commit

Permalink
Added some caching to the workflows (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
tr11 authored Aug 5, 2023
1 parent c00b2c7 commit bf60e2b
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,54 @@
name: Tests

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:

env:
POETRY_VERSION: 1.5.1

jobs:
testing:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Load cached Poetry installation
id: poetry
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-install-${{env.POETRY_VERSION}}-${{ runner.os }}-${{ matrix.python-version }}

- name: Install and configure Poetry
uses: snok/install-poetry@v1
if: steps.poetry.outputs.cache-hit != 'true'
with:
version: 1.5.1
version: ${{env.POETRY_VERSION}}
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-in-project: false

- name: Cache Poetry cache
uses: actions/cache@v3
id: cache
with:
path: ~/.cache/pypoetry
key: poetry-cache-${{env.POETRY_VERSION}}-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: poetry install -v -E toml -E yaml -E azure -E aws -E gcp -E vault

- name: Run pytest
Expand Down

0 comments on commit bf60e2b

Please sign in to comment.