Skip to content

Commit

Permalink
chore: refactor ci and poetry for new template
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemSBulgakov committed Sep 22, 2024
1 parent fcbbace commit c50c9fe
Show file tree
Hide file tree
Showing 7 changed files with 574 additions and 492 deletions.
23 changes: 23 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2
updates:
# Enable version updates for python packages
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
groups:
everything:
patterns:
- "*"

# Enable version updates for Docker
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"

# Enable version updates for Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
23 changes: 23 additions & 0 deletions .github/workflows/add-issues-to-project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Link issue to InNoHassle project

on:
issues:
types:
- opened
- reopened
- transferred
pull_request:
types:
- opened
- reopened

jobs:
add-to-project:
name: Add issue to project
if: github.repository_owner == 'one-zero-eight' # Do not run in forks
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
project-url: https://github.com/orgs/one-zero-eight/projects/4
github-token: ${{ secrets.ACTIONS_PAT_PROJECTS }}
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
key: ${{ secrets.SSH_KEY }}
fingerprint: ${{ secrets.SSH_FINGERPRINT }}
script_stop: true # Stop script on error
command_timeout: 30m
script: |
cd "${{ secrets.DEPLOY_DIRECTORY }}"
bash "${{ secrets.DEPLOY_SCRIPT }}"
Expand All @@ -54,6 +55,7 @@ jobs:
key: ${{ secrets.SSH_KEY }}
fingerprint: ${{ secrets.SSH_FINGERPRINT }}
script_stop: true # Stop script on error
command_timeout: 30m
script: |
cd "${{ secrets.DEPLOY_DIRECTORY }}"
bash "${{ secrets.DEPLOY_SCRIPT }}"
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'
- run: pip install pre-commit
- run: python -m pip freeze --local
- uses: actions/cache@v3
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Dockerfile from https://github.com/python-poetry/poetry/discussions/1879
# `python-base` sets up all our shared environment variables
FROM python:3.11.9-slim-bookworm as python-base
FROM python:3.12-slim-bookworm AS python-base
ENV PYTHONUNBUFFERED=1 \
# prevents python creating .pyc as files
PYTHONDONTWRITEBYTECODE=1 \
Expand All @@ -12,7 +12,7 @@ ENV PYTHONUNBUFFERED=1 \
\
# poetry
# https://python-poetry.org/docs/configuration/#using-environment-variables
POETRY_VERSION=1.6.1 \
POETRY_VERSION=1.8.3 \
# make poetry install to this location
POETRY_HOME="/opt/poetry" \
# make poetry create the virtual environment in the project's root
Expand All @@ -31,7 +31,7 @@ ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"


# `builder-base` stage is used to build deps + create our virtual environment
FROM python-base as builder-base
FROM python-base AS builder-base
RUN apt-get update && apt-get install --no-install-recommends -y \
# deps for installing poetry
curl \
Expand All @@ -46,11 +46,11 @@ WORKDIR $PYSETUP_PATH
COPY poetry.lock pyproject.toml ./

# install runtime deps - uses $POETRY_VIRTUALENVS_IN_PROJECT internally
RUN poetry install --no-dev
RUN poetry install


# `production` image used for runtime
FROM python-base as production
FROM python-base AS production
COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH

WORKDIR $PYSETUP_PATH
Expand Down
995 changes: 515 additions & 480 deletions poetry.lock

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@ description = ""
authors = ["Maxim Fomin <[email protected]>"]
license = "MIT"
readme = "README.md"
package-mode = false

[tool.poetry.dependencies]
python = "^3.11"
python = "^3.12"
aiogram = "^3"
aiogram-dialog = "^2.1.0"
python-dotenv = "^1.0.1"
requests = "^2.32.0"
aiohttp = {version = "^3", extras = ["speedups"]}
pydantic-settings = "^2"

[tool.poetry.group.dev.dependencies]
pre-commit = "^3.6.2"
pydantic-settings = "^2"
python-dotenv = "^1.0.1"
requests = "^2.32.0"
ruff = "^0.3.2"

[tool.ruff]
Expand Down

0 comments on commit c50c9fe

Please sign in to comment.