3 Commits

Author SHA1 Message Date
avm
b7e38b191f ci: expose dev manual actions on default branch
All checks were successful
CI/CD Pipeline / Manual Actions Require Dev Branch (push) Has been skipped
CI/CD Pipeline / Code Quality Checks (push) Successful in 2m40s
CI/CD Pipeline / Run Tests (push) Successful in 2m52s
CI/CD Pipeline / Telegram Notify Success (push) Successful in 11s
2026-04-28 12:52:12 +03:00
f55cd26277 ci: expose dev manual actions on default branch
All checks were successful
CI/CD Pipeline / Manual Actions Require Dev Branch (pull_request) Has been skipped
CI/CD Pipeline / Code Quality Checks (pull_request) Successful in 2m59s
CI/CD Pipeline / Run Tests (pull_request) Successful in 3m3s
CI/CD Pipeline / Telegram Notify Success (pull_request) Successful in 12s
2026-04-28 11:48:41 +02:00
avm
a4d2ae99b7 Merge pull request 'dev' (#9) from dev into main
All checks were successful
CI/CD Pipeline / Code Quality Checks (push) Successful in 2m5s
CI/CD Pipeline / Run Tests (push) Successful in 2m23s
CI/CD Pipeline / Telegram Notify Success (push) Successful in 1m30s
Reviewed-on: #9
2026-03-17 16:06:44 +03:00

View File

@@ -10,15 +10,31 @@ on:
branches: branches:
- main - main
- dev - dev
workflow_dispatch:
inputs:
manual_action:
description: "Manual action: dokploy_start or cleanup_dev_database"
required: true
default: "dokploy_start"
dokploy_target:
description: "Dokploy dev target: all, web, or celery"
required: true
default: "all"
cleanup_confirm:
description: "Type CLEAN_DEV_DB to drop and recreate the dev public schema"
required: false
default: ""
env: env:
PYTHON_VERSION: "3.11" PYTHON_VERSION: "3.11"
UV_VERSION: "0.7.2"
PIP_DISABLE_PIP_VERSION_CHECK: "1"
jobs: jobs:
lint: lint:
name: Code Quality Checks name: Code Quality Checks
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, '#no_lint') }} if: ${{ github.event_name != 'workflow_dispatch' && !contains(github.event.head_commit.message, '#no_lint') }}
env: env:
TG_BOT_KEY: ${{ secrets.TG_BOT_KEY }} TG_BOT_KEY: ${{ secrets.TG_BOT_KEY }}
TG_CHANNEL: ${{ secrets.TG_CHANNEL }} TG_CHANNEL: ${{ secrets.TG_CHANNEL }}
@@ -39,15 +55,20 @@ jobs:
add-apt-repository -y ppa:deadsnakes/ppa add-apt-repository -y ppa:deadsnakes/ppa
apt-get update apt-get update
apt-get install -y python3.11 python3.11-venv apt-get install -y python3.11 python3.11-venv
curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Create virtual environment and install dependencies - name: Create virtual environment and install dependencies
run: | run: |
set -euo pipefail set -euo pipefail
export PATH="$HOME/.local/bin:$PATH" python3.11 -m venv .venv
uv venv --python python3.11
. .venv/bin/activate . .venv/bin/activate
uv sync --dev --frozen python -m pip install "uv==${UV_VERSION}"
uv sync \
--dev \
--frozen \
--active \
--python "$(command -v python3.11)" \
--no-managed-python \
--no-python-downloads
- name: Run Ruff linting - name: Run Ruff linting
run: | run: |
@@ -63,6 +84,7 @@ jobs:
- name: Telegram notify (lint failed) - name: Telegram notify (lint failed)
if: failure() if: failure()
continue-on-error: true
run: | run: |
set -euo pipefail set -euo pipefail
if [ -z "${TG_BOT_KEY:-}" ] || [ -z "${TG_CHANNEL:-}" ]; then if [ -z "${TG_BOT_KEY:-}" ] || [ -z "${TG_CHANNEL:-}" ]; then
@@ -75,14 +97,18 @@ jobs:
sha=${GITHUB_SHA} sha=${GITHUB_SHA}
actor=${GITHUB_ACTOR}" actor=${GITHUB_ACTOR}"
curl -fsS -X POST "https://api.telegram.org/bot${TG_BOT_KEY}/sendMessage" \ curl -fsS \
--connect-timeout 5 \
--max-time 15 \
--retry 1 \
-X POST "https://api.telegram.org/bot${TG_BOT_KEY}/sendMessage" \
-d "chat_id=${TG_CHANNEL}" \ -d "chat_id=${TG_CHANNEL}" \
--data-urlencode "text=${MSG}" --data-urlencode "text=${MSG}"
test: test:
name: Run Tests name: Run Tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, '#no_test') }} if: ${{ github.event_name != 'workflow_dispatch' && !contains(github.event.head_commit.message, '#no_test') }}
env: env:
TG_BOT_KEY: ${{ secrets.TG_BOT_KEY }} TG_BOT_KEY: ${{ secrets.TG_BOT_KEY }}
TG_CHANNEL: ${{ secrets.TG_CHANNEL }} TG_CHANNEL: ${{ secrets.TG_CHANNEL }}
@@ -103,17 +129,22 @@ jobs:
add-apt-repository -y ppa:deadsnakes/ppa add-apt-repository -y ppa:deadsnakes/ppa
apt-get update apt-get update
apt-get install -y python3.11 python3.11-venv apt-get install -y python3.11 python3.11-venv
curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Create virtual environment and install dependencies - name: Create virtual environment and install dependencies
run: | run: |
set -euo pipefail set -euo pipefail
export PATH="$HOME/.local/bin:$PATH" python3.11 -m venv .venv
uv venv --python python3.11
. .venv/bin/activate . .venv/bin/activate
uv sync --dev --frozen python -m pip install "uv==${UV_VERSION}"
uv sync \
--dev \
--frozen \
--active \
--python "$(command -v python3.11)" \
--no-managed-python \
--no-python-downloads
- name: Run Django tests - name: Run pytest suite
env: env:
DJANGO_SETTINGS_MODULE: settings.test DJANGO_SETTINGS_MODULE: settings.test
SECRET_KEY: test-secret-key-for-ci SECRET_KEY: test-secret-key-for-ci
@@ -121,10 +152,11 @@ jobs:
set -euo pipefail set -euo pipefail
. .venv/bin/activate . .venv/bin/activate
export PYTHONPATH="${PWD}/src:${PYTHONPATH:-}" export PYTHONPATH="${PWD}/src:${PYTHONPATH:-}"
python src/manage.py test tests --verbosity=2 python -m pytest tests --ignore=tests/test_api_inventory_e2e.py -q
- name: Telegram notify (test failed) - name: Telegram notify (test failed)
if: failure() if: failure()
continue-on-error: true
run: | run: |
set -euo pipefail set -euo pipefail
if [ -z "${TG_BOT_KEY:-}" ] || [ -z "${TG_CHANNEL:-}" ]; then if [ -z "${TG_BOT_KEY:-}" ] || [ -z "${TG_CHANNEL:-}" ]; then
@@ -137,7 +169,11 @@ jobs:
sha=${GITHUB_SHA} sha=${GITHUB_SHA}
actor=${GITHUB_ACTOR}" actor=${GITHUB_ACTOR}"
curl -fsS -X POST "https://api.telegram.org/bot${TG_BOT_KEY}/sendMessage" \ curl -fsS \
--connect-timeout 5 \
--max-time 15 \
--retry 1 \
-X POST "https://api.telegram.org/bot${TG_BOT_KEY}/sendMessage" \
-d "chat_id=${TG_CHANNEL}" \ -d "chat_id=${TG_CHANNEL}" \
--data-urlencode "text=${MSG}" --data-urlencode "text=${MSG}"
@@ -147,6 +183,7 @@ jobs:
needs: [lint, test] needs: [lint, test]
if: | if: |
always() && always() &&
github.event_name != 'workflow_dispatch' &&
needs.lint.result == 'success' && needs.lint.result == 'success' &&
needs.test.result == 'success' needs.test.result == 'success'
env: env:
@@ -154,6 +191,7 @@ jobs:
TG_CHANNEL: ${{ secrets.TG_CHANNEL }} TG_CHANNEL: ${{ secrets.TG_CHANNEL }}
steps: steps:
- name: Telegram notify (lint+test success) - name: Telegram notify (lint+test success)
continue-on-error: true
env: env:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }} COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
run: | run: |
@@ -169,6 +207,23 @@ jobs:
actor=${GITHUB_ACTOR} actor=${GITHUB_ACTOR}
commit=${COMMIT_MESSAGE:-n/a}" commit=${COMMIT_MESSAGE:-n/a}"
curl -fsS -X POST "https://api.telegram.org/bot${TG_BOT_KEY}/sendMessage" \ curl -fsS \
--connect-timeout 5 \
--max-time 15 \
--retry 1 \
-X POST "https://api.telegram.org/bot${TG_BOT_KEY}/sendMessage" \
-d "chat_id=${TG_CHANNEL}" \ -d "chat_id=${TG_CHANNEL}" \
--data-urlencode "text=${MSG}" --data-urlencode "text=${MSG}"
manual_actions_require_dev:
name: Manual Actions Require Dev Branch
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/dev' }}
steps:
- name: Explain manual action branch
run: |
set -euo pipefail
echo "Manual actions are implemented in the dev workflow."
echo "Run this workflow with branch/ref dev."
exit 1