40 lines
888 B
YAML
40 lines
888 B
YAML
name: AS Talange CI/CD Pipeline
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
test:
|
|
name: Build & Run Unit Tests
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK 21
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '21'
|
|
distribution: 'temurin'
|
|
cache: 'maven'
|
|
|
|
- name: Run Maven Tests
|
|
run: mvn clean test
|
|
|
|
deploy:
|
|
name: Build & Run in Docker Container
|
|
needs: test
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Deploy with Docker Compose
|
|
run: |
|
|
echo "Building and restarting the application container..."
|
|
docker compose down app || true
|
|
docker compose up -d --build app
|
|
echo "Application is running at http://localhost:8080"
|