This commit is contained in:
@@ -1,56 +0,0 @@
|
|||||||
name: Deploy to Server
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- develop
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Set up SSH
|
|
||||||
uses: webfactory/ssh-agent@v0.5.0
|
|
||||||
with:
|
|
||||||
ssh-private-key: ${{ secrets.SERVER_SSH_KEY }}
|
|
||||||
|
|
||||||
- name: Add server to known hosts
|
|
||||||
run: |
|
|
||||||
ssh-keyscan -H staging.discours.io >> ~/.ssh/known_hosts
|
|
||||||
|
|
||||||
- name: Configure Git
|
|
||||||
run: |
|
|
||||||
git config --global user.email "gitea-actions@dscrs.site"
|
|
||||||
git config --global user.name "Gitea Actions"
|
|
||||||
|
|
||||||
- name: Prepare deployment
|
|
||||||
run: |
|
|
||||||
git init
|
|
||||||
git add .
|
|
||||||
git commit -m "Prepare for deployment: $(date +'%Y-%m-%d %H:%M:%S')"
|
|
||||||
|
|
||||||
- name: Deploy to Server
|
|
||||||
env:
|
|
||||||
SERVER_HOST: staging.discours.io
|
|
||||||
SERVER_USER: dokku
|
|
||||||
APP_NAME: core
|
|
||||||
run: |
|
|
||||||
git remote add dokku dokku@$SERVER_HOST:$APP_NAME
|
|
||||||
git push dokku HEAD:main -f
|
|
||||||
|
|
||||||
- name: Notify Deployment
|
|
||||||
if: success()
|
|
||||||
run: |
|
|
||||||
echo "Deployment to $APP_NAME successful"
|
|
||||||
|
|
||||||
- name: Handle Deployment Failure
|
|
||||||
if: failure()
|
|
||||||
run: |
|
|
||||||
echo "Deployment failed"
|
|
||||||
exit 1
|
|
||||||
@@ -10,6 +10,35 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Install uv
|
||||||
|
run: |
|
||||||
|
# Try multiple installation methods for uv
|
||||||
|
if curl -LsSf https://astral.sh/uv/install.sh | sh; then
|
||||||
|
echo "uv installed successfully via install script"
|
||||||
|
elif curl -LsSf https://github.com/astral-sh/uv/releases/latest/download/uv-installer.sh | sh; then
|
||||||
|
echo "uv installed successfully via GitHub installer"
|
||||||
|
else
|
||||||
|
echo "uv installation failed, using pip fallback"
|
||||||
|
pip install uv
|
||||||
|
fi
|
||||||
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
- name: Prepare Environment
|
||||||
|
run: |
|
||||||
|
uv --version
|
||||||
|
python3 --version
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: |
|
||||||
|
uv sync --frozen
|
||||||
|
|
||||||
|
- name: Run Tests
|
||||||
|
env:
|
||||||
|
TELEGRAM_BOT_TOKEN: dummy-token-for-tests
|
||||||
|
KB_REPO: "" # Отключаем синхронизацию в тестах
|
||||||
|
run: |
|
||||||
|
uv run pytest tests/ -v
|
||||||
|
|
||||||
- name: Get Repo Name
|
- name: Get Repo Name
|
||||||
id: repo_name
|
id: repo_name
|
||||||
run: echo "::set-output name=repo::$(echo ${GITHUB_REPOSITORY##*/})"
|
run: echo "::set-output name=repo::$(echo ${GITHUB_REPOSITORY##*/})"
|
||||||
@@ -24,7 +53,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
branch: 'main'
|
branch: 'main'
|
||||||
git_remote_url: 'ssh://dokku@v2.discours.io:22/discoursio-api'
|
git_remote_url: 'ssh://dokku@v2.discours.io:22/discoursio-api'
|
||||||
ssh_private_key: ${{ secrets.PROD_PRIVATE_KEY }}
|
ssh_private_key: ${{ secrets.V2_PRIVATE_KEY }}
|
||||||
|
|
||||||
- name: Push to dokku for dev branch
|
- name: Push to dokku for dev branch
|
||||||
if: github.ref == 'refs/heads/dev'
|
if: github.ref == 'refs/heads/dev'
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
name: Notification Module Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- develop
|
|
||||||
- 'feature/*'
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- develop
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
python-version: ['3.9', '3.10', '3.11']
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
|
||||||
uses: actions/setup-python@v3
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
|
|
||||||
- name: Install system dependencies
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y python3-dev libpq-dev
|
|
||||||
|
|
||||||
- name: Install Python dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install poetry
|
|
||||||
poetry config virtualenvs.create false
|
|
||||||
poetry install --no-interaction --no-ansi
|
|
||||||
|
|
||||||
- name: Run type checking
|
|
||||||
run: |
|
|
||||||
pip install mypy
|
|
||||||
mypy orm/notification.py
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: |
|
|
||||||
pip install pytest
|
|
||||||
pytest tests/test_notification.py -v
|
|
||||||
|
|
||||||
- name: Lint with ruff
|
|
||||||
run: |
|
|
||||||
pip install ruff
|
|
||||||
ruff check orm/notification.py
|
|
||||||
ruff format --check orm/notification.py
|
|
||||||
|
|
||||||
- name: Upload coverage to Codecov
|
|
||||||
uses: codecov/codecov-action@v3
|
|
||||||
with:
|
|
||||||
files: ./coverage.xml
|
|
||||||
flags: unittests
|
|
||||||
env_vars: OS,PYTHON
|
|
||||||
name: codecov-umbrella
|
|
||||||
fail_ci_if_error: true
|
|
||||||
40
.github/workflows/tests.yml
vendored
40
.github/workflows/tests.yml
vendored
@@ -1,40 +0,0 @@
|
|||||||
name: Notification Module Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ main, develop, feature/* ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ main, develop ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
python-version: [3.9, 3.10, 3.11]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
|
||||||
uses: actions/setup-python@v3
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install -r requirements.txt
|
|
||||||
pip install -r requirements.dev.txt
|
|
||||||
|
|
||||||
- name: Run mypy type checking
|
|
||||||
run: mypy orm/notification.py
|
|
||||||
|
|
||||||
- name: Run pytest for notification module
|
|
||||||
run: |
|
|
||||||
pytest tests/test_notification.py -v
|
|
||||||
|
|
||||||
- name: Lint with ruff
|
|
||||||
run: |
|
|
||||||
ruff check orm/notification.py
|
|
||||||
ruff format --check orm/notification.py
|
|
||||||
Reference in New Issue
Block a user