From fef7703eaa59457bd8c9c286c5fcf488b86b7a2c Mon Sep 17 00:00:00 2001 From: Kalyan Dutia Date: Mon, 2 Oct 2023 22:31:03 +0100 Subject: [PATCH] cache poetry package installs in CI --- .../.github/workflows/fixmes.yml | 2 +- .../.github/workflows/pre-commit.yml | 16 ++++++++++++---- .../.github/workflows/test.yml | 17 +++++++++++++---- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/{{ cookiecutter.repo_name }}/.github/workflows/fixmes.yml b/{{ cookiecutter.repo_name }}/.github/workflows/fixmes.yml index f3a2678..1d1c2ce 100644 --- a/{{ cookiecutter.repo_name }}/.github/workflows/fixmes.yml +++ b/{{ cookiecutter.repo_name }}/.github/workflows/fixmes.yml @@ -14,7 +14,7 @@ jobs: steps: - name: Check out repository code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Check code contains no FIXMEs run: | diff --git a/{{ cookiecutter.repo_name }}/.github/workflows/pre-commit.yml b/{{ cookiecutter.repo_name }}/.github/workflows/pre-commit.yml index 59c0b87..0955363 100644 --- a/{{ cookiecutter.repo_name }}/.github/workflows/pre-commit.yml +++ b/{{ cookiecutter.repo_name }}/.github/workflows/pre-commit.yml @@ -14,16 +14,24 @@ jobs: steps: - name: Check out repository code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v2 + - name: Install poetry + run: pipx install poetry==1.3.2 + + - name: Install python or load from cache with dependencies + uses: actions/setup-python@v4 with: python-version: "3.9" + cache: "poetry" + + - name: Install dependencies + run: | + poetry install - name: Install dependencies run: | - python -m pip install "poetry==1.3.2" && poetry install && poetry run pre-commit install + poetry install && poetry run pre-commit install - name: Run pre-commit checks run: | diff --git a/{{ cookiecutter.repo_name }}/.github/workflows/test.yml b/{{ cookiecutter.repo_name }}/.github/workflows/test.yml index ed970d7..6f237c5 100644 --- a/{{ cookiecutter.repo_name }}/.github/workflows/test.yml +++ b/{{ cookiecutter.repo_name }}/.github/workflows/test.yml @@ -14,16 +14,25 @@ jobs: steps: - name: Check out repository code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v2 + - name: Install poetry + run: pipx install poetry==1.3.2 + + - name: Install python or load from cache with dependencies + uses: actions/setup-python@v4 with: python-version: "3.9" + cache: "poetry" + + - name: Install dependencies + run: | + poetry install - name: Install dependencies run: | - python -m pip install "poetry==1.2.2" && poetry install + poetry install && poetry run pre-commit install + - name: Run test suite run: | poetry run python -m pytest \