fix: Fix pipeline, add ci and adapted compose
Some checks failed
CI / Run tests (pull_request) Failing after 20s
Some checks failed
CI / Run tests (pull_request) Failing after 20s
This commit is contained in:
@@ -2,15 +2,49 @@ name: CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, v2]
|
||||
branches: [main]
|
||||
|
||||
concurrency:
|
||||
group: cd-${{ github.ref_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
name: Build and push Docker image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v4
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
- name: Restore Docker build cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
- name: Build and push image
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKER_USERNAME }}/botmafieux:latest
|
||||
${{ secrets.DOCKER_USERNAME }}/botmafieux:${{ github.sha }}
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
|
||||
|
||||
deploy:
|
||||
name: Deploy to VPS
|
||||
needs: build-and-push
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Copy files to VPS
|
||||
- name: Copy compose file to VPS
|
||||
uses: appleboy/scp-action@v1
|
||||
with:
|
||||
host: ${{ secrets.VPS_HOST }}
|
||||
@@ -19,7 +53,6 @@ jobs:
|
||||
port: ${{ secrets.VPS_SSH_PORT }}
|
||||
source: "compose.yaml"
|
||||
target: "/opt/docker/botmafieux"
|
||||
|
||||
- name: Deploy on VPS
|
||||
uses: appleboy/ssh-action@v1
|
||||
with:
|
||||
@@ -28,12 +61,7 @@ jobs:
|
||||
key: ${{ secrets.VPS_SSH_KEY }}
|
||||
port: ${{ secrets.VPS_SSH_PORT }}
|
||||
script: |
|
||||
set -euo pipefail
|
||||
cd /opt/docker/botmafieux
|
||||
|
||||
docker compose -f compose.yaml --env-file .env down
|
||||
|
||||
docker compose -f compose.yaml --env-file .env build
|
||||
|
||||
docker compose -f compose.yaml --env-file .env up -d
|
||||
|
||||
docker compose -f compose.yaml --env-file .env.prod ps
|
||||
docker compose -f compose.yaml --env-file .env pull
|
||||
docker compose -f compose.yaml --env-file .env up -d --remove-orphans
|
||||
|
||||
22
.gitea/workflows/ci.yaml
Normal file
22
.gitea/workflows/ci.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Run tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.13
|
||||
- name: Install dependencies
|
||||
run: python -m pip install --no-cache-dir -r requirements.txt
|
||||
- name: Run pytest
|
||||
run: pytest -q
|
||||
Reference in New Issue
Block a user