Compare commits

...

17 Commits

Author SHA1 Message Date
EvanChal
87de65e6b2 ci/cd update 6
Some checks failed
Deploy to Production / build-and-deploy (push) Failing after 19s
2025-12-24 03:46:58 +01:00
EvanChal
7325f25b5f ci/cd update 5
Some checks failed
Deploy to Production / build-and-deploy (push) Failing after 2s
2025-12-24 03:45:04 +01:00
EvanChal
362b19fd66 ci/cd update 4
Some checks failed
Deploy to Production / build-and-deploy (push) Failing after 36s
2025-12-24 03:41:20 +01:00
EvanChal
7f8897d76d ci/cd update 3
Some checks failed
Deploy to Production / build-and-deploy (push) Failing after 21s
2025-12-24 03:35:04 +01:00
EvanChal
2bd07d09d3 ci/cd update 2
Some checks failed
Deploy to Production / build-and-deploy (push) Has been cancelled
2025-12-24 03:34:27 +01:00
EvanChal
d3446aa428 ci/cd update
Some checks failed
Deploy to Production / build-and-deploy (push) Has been cancelled
2025-12-24 03:32:09 +01:00
EvanChal
3fbf372dae update ci/cd 11
Some checks failed
Deploy to Development / build-and-deploy (push) Successful in 25s
Deploy to Production / test (push) Waiting to run
Deploy to Production / build-and-deploy (push) Has been cancelled
2025-12-24 00:31:13 +01:00
EvanChal
480ae1e40e update ci/cd 10
All checks were successful
Deploy to Development / build-and-deploy (push) Successful in 15s
2025-12-24 00:29:01 +01:00
EvanChal
857b136124 update ci/cd 9
Some checks failed
Deploy to Development / build-and-deploy (push) Failing after 14s
2025-12-24 00:25:59 +01:00
EvanChal
93c9935465 update ci/cd 8
Some checks failed
Deploy to Development / build-and-deploy (push) Failing after 16s
2025-12-24 00:19:53 +01:00
EvanChal
7cd468a859 update ci/cd 7
Some checks failed
Deploy to Development / build-and-deploy (push) Failing after 1m40s
2025-12-24 00:14:56 +01:00
EvanChal
eebd26bb7d update ci/cd 6
Some checks failed
Deploy to Development / build-and-deploy (push) Failing after 2s
2025-12-24 00:13:54 +01:00
EvanChal
414eb824f8 update ci/cd 5
Some checks failed
Deploy to Development / build-and-deploy (push) Failing after 2s
2025-12-24 00:12:05 +01:00
EvanChal
2319a8c0cb update ci/cd 4
Some checks failed
Deploy to Development / build-and-deploy (push) Failing after 4s
2025-12-24 00:10:29 +01:00
EvanChal
6cf379f01b update ci/cd 3
Some checks failed
Deploy to Development / build-and-deploy (push) Has been cancelled
2025-12-24 00:00:54 +01:00
EvanChal
b436e19087 update ci/cd 2
Some checks are pending
Deploy to Development / build-and-deploy (push) Waiting to run
2025-12-23 23:28:28 +01:00
EvanChal
ae3821a68e update ci/cd
Some checks failed
Deploy to Development / build-and-deploy (push) Failing after 9s
2025-12-23 23:25:15 +01:00
2 changed files with 53 additions and 139 deletions

View File

@@ -8,49 +8,23 @@ on:
jobs: jobs:
build-and-deploy: build-and-deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set up Docker Buildx - name: Login to Gitea Registry
uses: docker/setup-buildx-action@v2 run: |
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login ${{ secrets.REGISTRY_URL }} -u ${{ secrets.REGISTRY_USERNAME }} --password-stdin
- name: Login to Gitea Container Registry - name: Build and push
uses: docker/login-action@v2 run: |
with: echo "Building backend image..."
registry: ${{ secrets.GITEA_REGISTRY }} docker build -t ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USERNAME }}/lediscord:develop-backend ./backend
username: ${{ secrets.GITEA_USERNAME }} echo "Pushing backend image..."
password: ${{ secrets.GITEA_TOKEN }} docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USERNAME }}/lediscord:develop-backend
echo "Building frontend image..."
- name: Build and push backend image docker build -t ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USERNAME }}/lediscord:develop-frontend ./frontend
uses: docker/build-push-action@v4 echo "Pushing frontend image..."
with: docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USERNAME }}/lediscord:develop-frontend
context: ./backend
file: ./backend/Dockerfile
push: true
tags: ${{ secrets.GITEA_REGISTRY }}/${{ secrets.GITEA_USERNAME }}/lediscord-backend:develop
cache-from: type=registry,ref=${{ secrets.GITEA_REGISTRY }}/${{ secrets.GITEA_USERNAME }}/lediscord-backend:develop
cache-to: type=inline
- name: Build and push frontend image
uses: docker/build-push-action@v4
with:
context: ./frontend
file: ./frontend/Dockerfile
push: true
tags: ${{ secrets.GITEA_REGISTRY }}/${{ secrets.GITEA_USERNAME }}/lediscord-frontend:develop
cache-from: type=registry,ref=${{ secrets.GITEA_REGISTRY }}/${{ secrets.GITEA_USERNAME }}/lediscord-frontend:develop
cache-to: type=inline
- name: Deploy to development server
uses: appleboy/ssh-action@v0.1.7
with:
host: ${{ secrets.DEV_HOST }}
username: ${{ secrets.DEV_USERNAME }}
key: ${{ secrets.DEV_SSH_KEY }}
script: |
cd /path/to/lediscord
docker-compose pull
docker-compose up -d --build
docker-compose restart

View File

@@ -6,104 +6,44 @@ on:
- prod - prod
jobs: jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: lediscord_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install backend dependencies
run: |
cd backend
pip install -r requirements.txt
- name: Run backend tests
run: |
cd backend
python -m pytest tests/ -v || true
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/lediscord_test
JWT_SECRET_KEY: test-secret-key
CORS_ORIGINS: http://localhost:3000
ADMIN_EMAIL: test@test.com
ADMIN_PASSWORD: test123
ENVIRONMENT: test
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install frontend dependencies
run: |
cd frontend
npm ci
- name: Build frontend
run: |
cd frontend
npm run build
build-and-deploy: build-and-deploy:
needs: test
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set up Docker Buildx - name: Configure DNS
uses: docker/setup-buildx-action@v2 run: |
echo "nameserver 192.168.1.50" > /etc/resolv.conf
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
echo "DNS configured:"
cat /etc/resolv.conf
# Ajouter l'IP du registry à /etc/hosts si disponible
if [ -n "${{ secrets.REGISTRY_IP }}" ]; then
echo "${{ secrets.REGISTRY_IP }} ${{ secrets.REGISTRY_URL }}" >> /etc/hosts
echo "Added to /etc/hosts: ${{ secrets.REGISTRY_IP }} ${{ secrets.REGISTRY_URL }}"
fi
# Tester la résolution DNS
echo "Testing DNS resolution..."
getent hosts ${{ secrets.REGISTRY_URL }} || echo "DNS resolution test"
- name: Login to Gitea Container Registry - name: Login to Gitea Registry
uses: docker/login-action@v2 run: |
with: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login ${{ secrets.REGISTRY_URL }} -u ${{ secrets.REGISTRY_USERNAME }} --password-stdin
registry: ${{ secrets.GITEA_REGISTRY }}
username: ${{ secrets.GITEA_USERNAME }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Build and push backend image - name: Build and push
uses: docker/build-push-action@v4 run: |
with: echo "Building backend image..."
context: ./backend docker build -t ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USERNAME }}/lediscord:prod-backend ./backend
file: ./backend/Dockerfile docker tag ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USERNAME }}/lediscord:prod-backend ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USERNAME }}/lediscord:latest-backend
push: true echo "Pushing backend images..."
tags: | docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USERNAME }}/lediscord:prod-backend
${{ secrets.GITEA_REGISTRY }}/${{ secrets.GITEA_USERNAME }}/lediscord-backend:prod docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USERNAME }}/lediscord:latest-backend
${{ secrets.GITEA_REGISTRY }}/${{ secrets.GITEA_USERNAME }}/lediscord-backend:latest echo "Building frontend image..."
cache-from: type=registry,ref=${{ secrets.GITEA_REGISTRY }}/${{ secrets.GITEA_USERNAME }}/lediscord-backend:prod docker build -t ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USERNAME }}/lediscord:prod-frontend ./frontend
cache-to: type=inline docker tag ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USERNAME }}/lediscord:prod-frontend ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USERNAME }}/lediscord:latest-frontend
echo "Pushing frontend images..."
- name: Build and push frontend image docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USERNAME }}/lediscord:prod-frontend
uses: docker/build-push-action@v4 docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.REGISTRY_USERNAME }}/lediscord:latest-frontend
with:
context: ./frontend
file: ./frontend/Dockerfile
push: true
tags: |
${{ secrets.GITEA_REGISTRY }}/${{ secrets.GITEA_USERNAME }}/lediscord-frontend:prod
${{ secrets.GITEA_REGISTRY }}/${{ secrets.GITEA_USERNAME }}/lediscord-frontend:latest
cache-from: type=registry,ref=${{ secrets.GITEA_REGISTRY }}/${{ secrets.GITEA_USERNAME }}/lediscord-frontend:prod
cache-to: type=inline