Skip to content

CI Pipeline

CI Pipeline #478

Workflow file for this run

name: CI Pipeline
on:
push: # Trigger all pushes
pull_request:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight UTC
release:
types: [created, published]
jobs:
# Test jobs - run before building
client-test:
name: Test Client
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
cache-dependency-path: client/yarn.lock
- name: Install dependencies
working-directory: ./client
run: yarn install --frozen-lockfile
- name: Run tests
working-directory: ./client
run: yarn test --run
- name: Run linting
working-directory: ./client
run: yarn lint
server-test:
name: Test Server
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/gradle-build-action@v3
- name: Run server tests
run: gradle test
working-directory: ./server
genai-test:
name: Test GenAI Service
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
working-directory: ./genai
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
working-directory: ./genai
run: python -m pytest
server:
name: Build Server
runs-on: ubuntu-latest
needs: [server-test] # Wait for tests to pass
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up tag (replace / with -)
id: server_tag
run: |
SAFE_TAG=$(echo "${{ github.ref_name }}" | tr '/' '-')
echo "tag=$SAFE_TAG" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push server Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./server/Dockerfile
push: true
tags: |
ghcr.io/aet-devops25/team-robogo/server:latest
ghcr.io/aet-devops25/team-robogo/server:${{ github.sha }}
ghcr.io/aet-devops25/team-robogo/server:${{ steps.server_tag.outputs.tag }}
client:
name: Build Client
runs-on: ubuntu-latest
needs: [client-test] # Wait for tests to pass
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up tag (replace / with -)
id: client_tag
run: |
SAFE_TAG=$(echo "${{ github.ref_name }}" | tr '/' '-')
echo "tag=$SAFE_TAG" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push client Docker image
uses: docker/build-push-action@v6
with:
context: ./client
push: true
tags: |
ghcr.io/aet-devops25/team-robogo/client:latest
ghcr.io/aet-devops25/team-robogo/client:${{ github.sha }}
ghcr.io/aet-devops25/team-robogo/client:${{ steps.client_tag.outputs.tag }}
api-gateway:
name: Build API Gateway
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up tag (replace / with -)
id: gateway_tag
run: |
SAFE_TAG=$(echo "${{ github.ref_name }}" | tr '/' '-')
echo "tag=$SAFE_TAG" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push API Gateway Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./api-gateway/Dockerfile
push: true
tags: |
ghcr.io/aet-devops25/team-robogo/api-gateway:latest
ghcr.io/aet-devops25/team-robogo/api-gateway:${{ github.sha }}
ghcr.io/aet-devops25/team-robogo/api-gateway:${{ steps.gateway_tag.outputs.tag }}
genai:
name: Build GenAI Service
runs-on: ubuntu-latest
needs: [genai-test] # Wait for tests to pass
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up tag (replace / with -)
id: genai_tag
run: |
SAFE_TAG=$(echo "${{ github.ref_name }}" | tr '/' '-')
echo "tag=$SAFE_TAG" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push GenAI Docker image
uses: docker/build-push-action@v6
with:
context: ./genai
file: ./genai/Dockerfile
push: true
tags: |
ghcr.io/aet-devops25/team-robogo/genai:latest
ghcr.io/aet-devops25/team-robogo/genai:${{ github.sha }}
ghcr.io/aet-devops25/team-robogo/genai:${{ steps.genai_tag.outputs.tag }}