Files
corestate/.github/workflows/microservices.yml
Wiktor 2d9d377712 fix: resolve all GitHub workflow failures and build issues
Comprehensive fixes to achieve 100% CI/CD success rate:

🚀 Android Dependencies:
- Add JitPack repository for MPAndroidChart support
- Replace problematic WebRTC with working Stream WebRTC alternative
- Fix dependency resolution in both androidApp and shared modules

🏗️ Kotlin Microservices:
- Add missing SpringDoc OpenAPI and WebFlux dependencies
- Create complete model classes (BackupJob, RestoreJob, BackupSnapshot)
- Implement missing repository interfaces and service clients
- Rewrite BackupOrchestrator with proper type safety

 Rust Services:
- Create comprehensive compression benchmark suite
- Add performance tests for ZSTD, LZ4, Brotli, GZIP algorithms
- Include parallel vs sequential compression benchmarks

🔧 Native Module Build:
- Create missing CMakeLists.txt for all native components
- Fix snapshot_manager, fs_monitor, hw_acceleration builds
- Establish proper library linking structure

🔒 Security Workflows:
- Add conditional Docker image building with proper error handling
- Make FOSSA scan conditional on API key availability
- Enhance infrastructure scanning with directory validation
- Improve SARIF file generation and upload reliability

📱 Node.js Services:
- Add encryption-service to testing matrix alongside sync-coordinator
- Ensure comprehensive test coverage for TypeScript services

Created by: Wiktor (overspend1)
Version: 2.0.0 - Production Ready CI/CD
2025-07-23 23:34:48 +02:00

216 lines
6.4 KiB
YAML

name: Microservices CI
on:
push:
branches: [ main, develop ]
paths:
- 'services/**'
- 'shared/**'
pull_request:
branches: [ main ]
paths:
- 'services/**'
- 'shared/**'
env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx2048m -Dorg.gradle.daemon=false"
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test-kotlin-services:
runs-on: ubuntu-latest
strategy:
matrix:
service: [backup-engine]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Test ${{ matrix.service }}
run: ./gradlew :services:${{ matrix.service }}:test
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.service }}
path: |
services/${{ matrix.service }}/build/reports/tests/
services/${{ matrix.service }}/build/test-results/
test-rust-services:
runs-on: ubuntu-latest
strategy:
matrix:
service: [storage-hal, compression-engine]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
services/${{ matrix.service }}/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('services/${{ matrix.service }}/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Run tests for ${{ matrix.service }}
run: |
cd services/${{ matrix.service }}
cargo test
- name: Run clippy for ${{ matrix.service }}
run: |
cd services/${{ matrix.service }}
cargo clippy -- -D warnings
- name: Check formatting for ${{ matrix.service }}
run: |
cd services/${{ matrix.service }}
cargo fmt --check
test-python-services:
runs-on: ubuntu-latest
strategy:
matrix:
service: [ml-optimizer]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('services/${{ matrix.service }}/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies for ${{ matrix.service }}
run: |
cd services/${{ matrix.service }}
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov black flake8
- name: Run tests for ${{ matrix.service }}
run: |
cd services/${{ matrix.service }}
pytest --cov=. --cov-report=xml
- name: Check code formatting for ${{ matrix.service }}
run: |
cd services/${{ matrix.service }}
black --check .
- name: Run linting for ${{ matrix.service }}
run: |
cd services/${{ matrix.service }}
flake8 .
test-nodejs-services:
runs-on: ubuntu-latest
strategy:
matrix:
service: [sync-coordinator, encryption-service]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js 18
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: 'services/${{ matrix.service }}/package.json'
- name: Install dependencies for ${{ matrix.service }}
run: |
cd services/${{ matrix.service }}
npm install
- name: Run tests for ${{ matrix.service }}
run: |
cd services/${{ matrix.service }}
npm test
- name: Run linting for ${{ matrix.service }}
run: |
cd services/${{ matrix.service }}
npm run lint
- name: Type check for ${{ matrix.service }}
run: |
cd services/${{ matrix.service }}
npm run type-check
build-docker-images:
needs: [test-kotlin-services, test-rust-services, test-python-services, test-nodejs-services]
runs-on: ubuntu-latest
strategy:
matrix:
service: [backup-engine, storage-hal, compression-engine, ml-optimizer, sync-coordinator]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ matrix.service }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./services/${{ matrix.service }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}