82 lines
2.3 KiB
YAML
82 lines
2.3 KiB
YAML
# Template
|
|
name: CI/CD Docker Compose
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- develop
|
|
|
|
jobs:
|
|
validate:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
#
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
#
|
|
- name: Validate file docker-compose.yml
|
|
run: |
|
|
docker-compose config -q
|
|
|
|
deploy-and-test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
#
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
# https://github.com/docker/setup-qemu-action#usage
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3.2.0
|
|
|
|
# https://github.com/marketplace/actions/docker-setup-buildx
|
|
# - name: Set up Docker Buildx
|
|
# id: buildx
|
|
# uses: docker/setup-buildx-action@v3.6.1
|
|
|
|
- name: Create necessary Docker networks
|
|
run: |
|
|
docker network create back_network || true
|
|
docker network create traefik_front_network || true
|
|
|
|
- name: Start up services using Docker Compose
|
|
run: docker compose up -d
|
|
|
|
- name: Modify /etc/hosts for internal routing
|
|
run: |
|
|
echo "127.0.0.1 docuseal.tips-of-mine.com" | sudo tee -a /etc/hosts
|
|
|
|
- name: Wait
|
|
run: |
|
|
# Attendre que les services soient prêts (adapter selon vos besoins)
|
|
sleep 30
|
|
|
|
- name: Print Docker Compose services status
|
|
run: docker ps
|
|
|
|
- name: Wait for the application to be ready via Traefik
|
|
run: |
|
|
echo "Checking the routing and availability of application via Traefik..."
|
|
timeout 5m bash -c 'while ! curl -fsSLk "https://gitea.tips-of-mine.com"; do echo "Waiting for the application to be ready..."; sleep 10; done'
|
|
|
|
- name: Inspect Network Configuration
|
|
run: |
|
|
docker network inspect back_network
|
|
docker network inspect traefik_front_network
|
|
|
|
- name: Shutdown Docker Compose services
|
|
if: always()
|
|
run: docker compose -f docker-compose.yml down
|
|
|
|
- name: Fusionner dans main (si les tests réussissent)
|
|
if: success()
|
|
run: |
|
|
git config user.name 'Gitea Actions'
|
|
git config user.email 'actions@gitea.io'
|
|
git checkout main
|
|
git merge develop --no-ff -m "Fusion automatique de develop suite aux tests réussis"
|
|
git push origin main
|