Bump actions/cache from 4.0.2 to 4.1.2 #264
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Things to check before start: | |
# * https://github.com/marketplace/actions/python-poetry-action | |
# * https://github.com/packetcoders/action-setup-cache-python-poetry/blob/main/action.yml | |
# * https://gist.github.com/soof-golan/6ebb97a792ccd87816c0bda1e6e8b8c2 | |
# * https://github.com/nicoloboschi/poetry-dockerize-plugin | |
# * https://github.com/wemake-services/wemake-django-template/blob/master/%7B%7Bcookiecutter.project_name%7D%7D/docker/django/Dockerfile | |
# * https://github.com/orgs/python-poetry/discussions/1879 | |
name: "tests" | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: ~ | |
env: | |
PYTHON_VERSION: 3.13.0 | |
POETRY_VERSION: 1.8.4 | |
jobs: | |
test: | |
runs-on: ubuntu-24.04 | |
services: | |
postgres: | |
image: postgres:16.4-alpine3.20 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
ports: | |
- 5432:5432 | |
redis: | |
image: redis:7.4.0-alpine3.20 | |
ports: | |
- 6379:6379 | |
steps: | |
- uses: actions/[email protected] | |
name: Checkout | |
- uses: actions/[email protected] | |
id: setup_python | |
name: Set up Python ${{ env.PYTHON_VERSION }} | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- uses: actions/[email protected] | |
name: Cache for Poetry setup | |
id: poetry_install_cache | |
with: | |
key: poetry_install-${{ runner.os }}-${{ env.PYTHON_VERSION }}-poetry-${{ env.POETRY_VERSION }} | |
path: ${{ env.pythonLocation }} | |
restore-keys: | | |
poetry_install-${{ runner.os }}-${{ env.PYTHON_VERSION }}-poetry- | |
- name: Setup Poetry | |
if: steps.poetry_install_cache.outputs.cache-hit != 'true' | |
run: pip install poetry==${{ env.POETRY_VERSION }} | |
# TODO: | |
# This step must be cached too; but with current small list of packages, | |
# installing them is faster than cache retrieval and update. | |
- name: Install packages | |
run: poetry install | |
- name: Run tests | |
working-directory: ./src | |
env: | |
APP_REDIS_URL: "redis://localhost:${{ job.services.redis.ports[6379] }}/1" | |
CELERY_BROKER_URL: "" | |
CELERY_RESULT_BACKEND: "" | |
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres | |
SECRET_KEY: "" | |
run: | | |
poetry run python manage.py wait_for_db | |
poetry run python manage.py wait_for_cache | |
poetry run python manage.py test --parallel --shuffle |