Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Uses setup-python poetry cache #39

Merged
merged 8 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ on:

jobs:
python:
name: python
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
python: [3.12]

name: python ${{ matrix.python }}
runs-on: ${{ matrix.os }}
env:
ENVIRONMENT: prod
steps:
Expand All @@ -25,27 +30,35 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install Poetry
run: |
pipx install poetry
poetry config virtualenvs.in-project true

- name: Set up Python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: 3.12

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
python-version: ${{ matrix.python }}
cache: poetry

- name: Poetry cache
if: ${{ steps.setup-python.outputs.cache-hit != 'true' }}
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-pypoetry-${{ hashFiles('**/poetry.lock') }}
key: pypoetry-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-pypoetry-${{ hashFiles('**/poetry.lock') }}
${{ runner.os }}-pypoetry-
pypoetry-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
pypoetry-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}
pypoetry-${{ runner.os }}

- name: Run CI
run: ENVIRONMENT=ci make run-ci
env:
ENVIRONMENT: ci
run: |
source $(poetry env info --path)/bin/activate
make run-ci

docker:
name: docker
Expand Down
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,15 @@ help: ## print help message

## dependencies

.PHONY: deps-install
deps-install: ## install dependencies
.PHONY: deps-install-python
deps-install-python:
poetry install
python -m pre_commit install --install-hooks

.PHONY: deps-install-ci
deps-install-ci:
poetry install --no-root
pip list

.PHONY: deps-install
deps-install: deps-install-python ## install dependencies
python -m pre_commit install --install-hooks

.PHONY: deps-update
deps-update:
poetry update
Expand Down Expand Up @@ -72,7 +71,7 @@ test:
python -m pytest $(TEST_DIR) --cov $(SOURCE_DIR)

.PHONY: run-ci
run-ci: deps-install-ci lint test ## run ci
run-ci: deps-install-python lint test ## run ci

## app

Expand Down