first sync
This commit is contained in:
@ -1,70 +1,113 @@
|
||||
# Template
|
||||
name: Deployment Verification
|
||||
name: CI/CD Docker Compose
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
tags:
|
||||
- "v[0-9]+.[0-9]+.[0-9]"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
deploy-and-test:
|
||||
Validate:
|
||||
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
|
||||
with:
|
||||
platforms: all
|
||||
|
||||
#
|
||||
- name: Check the presence file docker-compose.yml
|
||||
run: |
|
||||
if [ ! -f "docker-compose.yml" ]; then
|
||||
echo "Error : file docker-compose.yml is missing."
|
||||
exit 1
|
||||
fi
|
||||
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
|
||||
with:
|
||||
platforms: all
|
||||
|
||||
#
|
||||
- name: Installer Docker Compose
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y docker-compose
|
||||
apt-get install -y bc
|
||||
|
||||
# https://github.com/marketplace/actions/docker-setup-buildx
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
# id: buildx
|
||||
uses: docker/setup-buildx-action@v3.6.1
|
||||
|
||||
# https://github.com/docker/build-push-action
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
|
||||
#
|
||||
- name: Create necessary Docker networks
|
||||
- name: Building images
|
||||
run: |
|
||||
docker network create back_network || true
|
||||
docker network create traefik_front_network || true
|
||||
docker compose build
|
||||
|
||||
# - 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 -f docker-compose.yml up -d
|
||||
run: docker compose up -d
|
||||
|
||||
# - name: Modify /etc/hosts for internal routing
|
||||
# run: |
|
||||
# echo "127.0.0.1 gitea.tips-of-mine.com" | sudo tee -a /etc/hosts
|
||||
- name: Modify /etc/hosts for internal routing
|
||||
run: |
|
||||
echo "127.0.0.1 docuseal.tips-of-mine.com" | sudo tee -a /etc/hosts
|
||||
|
||||
- name: Waiting for services to be ready
|
||||
run: |
|
||||
sleep 20
|
||||
|
||||
- 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://metabase.tips-of-mine.com"; do echo "Waiting for the application to be ready..."; sleep 10; done'
|
||||
# - 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://docuseal.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: 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
|
||||
run: docker compose down
|
||||
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
- name: Incrémenter le numéro de version
|
||||
if: success()
|
||||
run: |
|
||||
docker compose --profile setup down
|
||||
rm -rf /workspace/tips-of-mine/metabase/*
|
||||
current_version=$(cat VERSION)
|
||||
new_version=$(echo "$current_version + 1" | bc)
|
||||
echo "$current_version" > VERSION
|
||||
git config user.name 'Gitea Actions'
|
||||
git config user.email 'actions@gitea.io'
|
||||
git add VERSION
|
||||
git commit -m "Incrémentation automatique de la version à $current_version"
|
||||
|
||||
- name: Fusionner dans main
|
||||
if: success()
|
||||
run: |
|
||||
git checkout main
|
||||
git merge develop --no-ff -m "Fusion automatique de develop suite aux tests réussis"
|
||||
git push origin main
|
||||
|
@ -3,49 +3,68 @@ name: Deployment Verification
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- "v[0-9]+.[0-9]+.[0-9]"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
# https://github.com/docker/setup-qemu-action#usage
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3.2.0
|
||||
|
||||
- name: Create necessary Docker networks
|
||||
run: |
|
||||
docker network create back_network_{ vars.APPLICATION_NAME } || true
|
||||
docker network create traefik_front_network || true
|
||||
# https://github.com/marketplace/actions/docker-setup-buildx
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v3.6.1
|
||||
|
||||
- name: Start up services using Docker Compose
|
||||
run: docker compose -f docker-compose.yml up -d
|
||||
# https://github.com/docker/build-push-action
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
|
||||
#
|
||||
- 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 -f docker-compose.yml up -d
|
||||
|
||||
# - name: Modify /etc/hosts for internal routing
|
||||
# run: |
|
||||
# echo "127.0.0.1 { vars.APPLICATION_URL }" | sudo tee -a /etc/hosts
|
||||
# echo "127.0.0.1 dashboard.tips-of-mine.com" | sudo tee -a /etc/hosts
|
||||
# echo "127.0.0.1 gitea.tips-of-mine.com" | sudo tee -a /etc/hosts
|
||||
|
||||
- name: Print Docker Compose services status
|
||||
run: docker ps
|
||||
- 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://{ vars.APPLICATION_URL }"; do echo "Waiting for the application to be ready..."; sleep 10; done'
|
||||
- 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://metabase.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_{ vars.APPLICATION_NAME }
|
||||
docker network inspect traefik_front_network
|
||||
- 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: Shutdown Docker Compose services
|
||||
if: always()
|
||||
run: docker compose -f docker-compose.yml down
|
||||
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
run: |
|
||||
docker compose --profile setup down
|
||||
rm -rf /workspace/tips-of-mine/metabase/*
|
Reference in New Issue
Block a user