- Add fail-on-cache-miss: false to all cache actions in workflows - Create improved runner configuration (config_cache_fixed.yaml) with: - Fixed cache host: host.docker.internal - Fixed cache port: 44029 - Host network mode for better container networking - Add cache troubleshooting scripts: - fix-cache-issues.sh (Linux/macOS) - fix-cache-issues.ps1 (Windows) - Update all workflows: api-gateway, frontend, service-adapters, api-docs, ci This resolves the 'connect ETIMEDOUT 172.31.0.3:44029' errors by: 1. Making cache failures non-fatal 2. Using proper Docker networking configuration 3. Providing tools to diagnose and fix cache issues
129 lines
3.1 KiB
YAML
129 lines
3.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/**'
|
|
|
|
env:
|
|
REGISTRY: gitea.example.com
|
|
IMAGE_PREFIX: labfusion
|
|
SERVICE_NAME: api-gateway
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: [self-hosted]
|
|
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
|
|
key: ${{ runner.os }}-m2-${{ matrix.java-version }}-${{ hashFiles('**/pom.xml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-m2-${{ matrix.java-version }}-
|
|
${{ runner.os }}-m2-
|
|
fail-on-cache-miss: false
|
|
|
|
- name: Validate POM
|
|
run: ./mvnw validate
|
|
|
|
- name: Compile code
|
|
run: ./mvnw compile
|
|
|
|
- name: Run unit tests
|
|
run: ./mvnw test
|
|
|
|
- name: Generate test report
|
|
uses: dorny/test-reporter@v1
|
|
if: success() || failure()
|
|
with:
|
|
name: Maven Tests (Java ${{ matrix.java-version }})
|
|
path: services/api-gateway/target/surefire-reports/*.xml
|
|
reporter: java-junit
|
|
|
|
- name: Run code quality checks
|
|
run: |
|
|
./mvnw spotbugs:check
|
|
./mvnw checkstyle:check
|
|
./mvnw pmd:check
|
|
|
|
- name: Generate code coverage
|
|
run: ./mvnw jacoco:report
|
|
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
file: ./services/api-gateway/target/site/jacoco/jacoco.xml
|
|
flags: api-gateway
|
|
name: api-gateway-coverage
|
|
|
|
build:
|
|
runs-on: [self-hosted]
|
|
needs: test
|
|
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
|
|
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
|
restore-keys: ${{ runner.os }}-m2
|
|
fail-on-cache-miss: false
|
|
|
|
- name: Build application
|
|
run: ./mvnw clean package -DskipTests
|
|
|
|
- name: Build Docker image (test only)
|
|
run: docker build -t api-gateway:test .
|
|
|
|
security:
|
|
runs-on: [self-hosted]
|
|
needs: build
|
|
|