Some checks failed
API Docs (Node.js Express) / test (20) (push) Failing after 43s
API Docs (Node.js Express) / build (push) Has been skipped
Integration Tests / integration-tests (push) Failing after 24s
Integration Tests / performance-tests (push) Has been skipped
Frontend (React) / test (20) (push) Failing after 1m25s
Frontend (React) / build (push) Has been skipped
Service Adapters (Python FastAPI) / test (3.11) (push) Failing after 23s
Service Adapters (Python FastAPI) / test (3.12) (push) Failing after 23s
Frontend (React) / lighthouse (push) Has been skipped
Service Adapters (Python FastAPI) / test (3.13) (push) Failing after 22s
Service Adapters (Python FastAPI) / build (push) Has been skipped
API Gateway (Java Spring Boot) / test (17) (push) Successful in 2m1s
API Gateway (Java Spring Boot) / test (21) (push) Successful in 2m7s
API Gateway (Java Spring Boot) / build (push) Successful in 2m2s
### Summary of Changes - Removed unnecessary Docker build steps from the CI workflows for API Docs, API Gateway, and Frontend. - Streamlined the build process by eliminating duplicate commands, enhancing clarity and maintainability. ### Expected Results - Improved readability of CI configuration and reduced complexity in the build process, making it easier to manage and update in the future.
156 lines
4.1 KiB
YAML
156 lines
4.1 KiB
YAML
name: API Gateway (Java Spring Boot)
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- 'services/api-gateway/**'
|
|
- '.gitea/workflows/api-gateway.yml'
|
|
pull_request:
|
|
paths:
|
|
- 'services/api-gateway/**'
|
|
workflow_dispatch:
|
|
inputs:
|
|
run_tests:
|
|
description: 'Run tests'
|
|
required: false
|
|
default: true
|
|
type: boolean
|
|
run_lint:
|
|
description: 'Run linting'
|
|
required: false
|
|
default: true
|
|
type: boolean
|
|
run_build:
|
|
description: 'Run build'
|
|
required: false
|
|
default: true
|
|
type: boolean
|
|
run_sonar:
|
|
description: 'Run SonarQube analysis'
|
|
required: false
|
|
default: true
|
|
type: boolean
|
|
|
|
env:
|
|
REGISTRY: gitea.example.com
|
|
IMAGE_PREFIX: labfusion
|
|
SERVICE_NAME: api-gateway
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: [self-hosted]
|
|
env:
|
|
RUNNER_TOOL_CACHE: /toolcache
|
|
defaults:
|
|
run:
|
|
working-directory: ./services/api-gateway
|
|
|
|
strategy:
|
|
matrix:
|
|
java-version: [17, 21]
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK ${{ matrix.java-version }}
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: ${{ matrix.java-version }}
|
|
distribution: 'temurin'
|
|
cache: maven
|
|
|
|
- name: Make Maven wrapper executable
|
|
run: chmod +x ./mvnw
|
|
|
|
- name: Verify Maven installation
|
|
run: ./mvnw --version
|
|
|
|
- name: Cache Maven dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.m2/repository
|
|
~/.m2/wrapper
|
|
key: maven-${{ runner.os }}-${{ matrix.java-version }}-${{ hashFiles('**/pom.xml') }}
|
|
restore-keys: |
|
|
maven-${{ runner.os }}-${{ matrix.java-version }}-
|
|
maven-${{ runner.os }}-
|
|
maven-
|
|
fail-on-cache-miss: false
|
|
|
|
- name: Validate POM
|
|
run: ./mvnw validate
|
|
|
|
- name: Compile code
|
|
run: ./mvnw compile
|
|
|
|
- name: Run unit tests
|
|
run: |
|
|
echo "Running Maven tests..."
|
|
./mvnw test -X
|
|
echo "Maven test execution completed"
|
|
echo "Checking target directory structure..."
|
|
find target -name "*.xml" -type f 2>/dev/null || echo "No XML files found in target"
|
|
echo "Checking surefire-reports directory..."
|
|
if [ -d "target/surefire-reports" ]; then
|
|
echo "Contents of surefire-reports:"
|
|
ls -la target/surefire-reports/
|
|
else
|
|
echo "surefire-reports directory does not exist"
|
|
echo "Creating surefire-reports directory..."
|
|
mkdir -p target/surefire-reports
|
|
fi
|
|
|
|
- name: Send test results to SonarQube
|
|
run: |
|
|
echo "Sending test results to SonarQube..."
|
|
./mvnw clean verify sonar:sonar \
|
|
-Dsonar.projectKey=labfusion-api-gateway \
|
|
-Dsonar.projectName=LabFusion-API-Gateway \
|
|
-Dsonar.host.url="${{ secrets.SONAR_HOST_URL }}" \
|
|
-Dsonar.token="${{ secrets.SONAR_TOKEN }}" \
|
|
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml \
|
|
-Dsonar.junit.reportPaths=target/surefire-reports
|
|
|
|
build:
|
|
runs-on: [self-hosted]
|
|
needs: test
|
|
env:
|
|
RUNNER_TOOL_CACHE: /toolcache
|
|
defaults:
|
|
run:
|
|
working-directory: ./services/api-gateway
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '17'
|
|
distribution: 'temurin'
|
|
cache: maven
|
|
|
|
- name: Make Maven wrapper executable
|
|
run: chmod +x ./mvnw
|
|
|
|
- name: Verify Maven installation
|
|
run: ./mvnw --version
|
|
|
|
- name: Cache Maven dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.m2/repository
|
|
~/.m2/wrapper
|
|
key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
|
|
restore-keys: |
|
|
maven-${{ runner.os }}-
|
|
maven-
|
|
fail-on-cache-miss: false
|
|
|
|
- name: Build application
|
|
run: ./mvnw clean package -DskipTests
|
|
|