From bf60e2b0504558f1b7e3666e7c88cc2caac1d7ef Mon Sep 17 00:00:00 2001 From: Tiago Requeijo Date: Sat, 5 Aug 2023 15:47:13 -0400 Subject: [PATCH] Added some caching to the workflows (#85) --- .github/workflows/run_tests.yml | 36 +++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 9a76940..d833ab2 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -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