From 8b93ce0f631544e814e60c184db37ef095b0d6cb Mon Sep 17 00:00:00 2001 From: Untone Date: Tue, 12 Aug 2025 13:04:12 +0300 Subject: [PATCH] ci-upgrade --- .gitea/workflows/deploy.yml | 56 -------------------------------- .gitea/workflows/main.yml | 31 +++++++++++++++++- .gitea/workflows/tests.yml | 65 ------------------------------------- .github/workflows/tests.yml | 40 ----------------------- 4 files changed, 30 insertions(+), 162 deletions(-) delete mode 100644 .gitea/workflows/deploy.yml delete mode 100644 .gitea/workflows/tests.yml delete mode 100644 .github/workflows/tests.yml diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml deleted file mode 100644 index fc84d1d8..00000000 --- a/.gitea/workflows/deploy.yml +++ /dev/null @@ -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 diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index 9491ec4d..7acf914b 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -10,6 +10,35 @@ jobs: with: 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 id: repo_name run: echo "::set-output name=repo::$(echo ${GITHUB_REPOSITORY##*/})" @@ -24,7 +53,7 @@ jobs: with: branch: 'main' 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 if: github.ref == 'refs/heads/dev' diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml deleted file mode 100644 index 72978587..00000000 --- a/.gitea/workflows/tests.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index fc4240b2..00000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -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