Files
as-talange/.gitea/workflows/ci.yml
T
ucef fc81b9e1ac
AS Talange CI/CD Pipeline / Build & Run Unit Tests (push) Successful in 2m57s
AS Talange CI/CD Pipeline / Build & Run in Docker Container (push) Failing after 2m35s
ci: migration vers une architecture de pipeline basée sur des conteneurs dédiés
2026-05-31 00:54:07 +02:00

52 lines
1.5 KiB
YAML

name: AS Talange CI/CD Pipeline
on:
push:
branches:
- main
jobs:
test:
name: Build & Run Unit Tests
runs-on: self-hosted
container:
image: maven:3.9.6-eclipse-temurin-21
steps:
- name: Clone repository
run: |
# Install git if not present in the maven image
if ! command -v git &> /dev/null; then
apt-get update && apt-get install -y git
fi
SERVER_URL="${{ github.server_url }}"
SERVER_NO_PROTO="${SERVER_URL#http://}"
SERVER_NO_PROTO="${SERVER_NO_PROTO#https://}"
git clone --depth 1 "https://oauth2:${{ secrets.GITHUB_TOKEN }}@${SERVER_NO_PROTO}/${{ github.repository }}.git" .
git checkout ${{ github.sha }}
- name: Run Maven Tests
run: mvn clean test
deploy:
name: Build & Run in Docker Container
needs: test
runs-on: self-hosted
container:
image: docker:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
steps:
- name: Clone repository
run: |
apk add --no-cache git
SERVER_URL="${{ github.server_url }}"
SERVER_NO_PROTO="${SERVER_URL#http://}"
SERVER_NO_PROTO="${SERVER_NO_PROTO#https://}"
git clone --depth 1 "https://oauth2:${{ secrets.GITHUB_TOKEN }}@${SERVER_NO_PROTO}/${{ github.repository }}.git" .
git checkout ${{ github.sha }}
- name: Deploy with Docker Compose
run: |
docker compose down app || true
docker compose up -d --build app