chore: Add workflow dispatch inputs for CI configurations across services
Some checks failed
API Gateway (Java Spring Boot) / test (17) (push) Failing after 35s
API Gateway (Java Spring Boot) / test (21) (push) Failing after 36s
API Gateway (Java Spring Boot) / build (push) Has been skipped
API Gateway (Java Spring Boot) / security (push) Has been skipped
Integration Tests / integration-tests (push) Failing after 34s
Integration Tests / performance-tests (push) Has been skipped
Service Adapters (Python FastAPI) / test (3.1) (push) Failing after 14s
API Docs (Node.js Express) / test (20) (push) Successful in 1m29s
Service Adapters (Python FastAPI) / test (3.11) (push) Failing after 41s
Service Adapters (Python FastAPI) / test (3.12) (push) Failing after 43s
Frontend (React) / test (20) (push) Successful in 1m44s
Service Adapters (Python FastAPI) / test (3.9) (push) Failing after 43s
Service Adapters (Python FastAPI) / build (push) Has been skipped
API Docs (Node.js Express) / build (push) Successful in 40s
Docker Build and Push / build-and-push (push) Failing after 3m6s
Frontend (React) / build (push) Successful in 2m26s
Frontend (React) / lighthouse (push) Has been skipped
Some checks failed
API Gateway (Java Spring Boot) / test (17) (push) Failing after 35s
API Gateway (Java Spring Boot) / test (21) (push) Failing after 36s
API Gateway (Java Spring Boot) / build (push) Has been skipped
API Gateway (Java Spring Boot) / security (push) Has been skipped
Integration Tests / integration-tests (push) Failing after 34s
Integration Tests / performance-tests (push) Has been skipped
Service Adapters (Python FastAPI) / test (3.1) (push) Failing after 14s
API Docs (Node.js Express) / test (20) (push) Successful in 1m29s
Service Adapters (Python FastAPI) / test (3.11) (push) Failing after 41s
Service Adapters (Python FastAPI) / test (3.12) (push) Failing after 43s
Frontend (React) / test (20) (push) Successful in 1m44s
Service Adapters (Python FastAPI) / test (3.9) (push) Failing after 43s
Service Adapters (Python FastAPI) / build (push) Has been skipped
API Docs (Node.js Express) / build (push) Successful in 40s
Docker Build and Push / build-and-push (push) Failing after 3m6s
Frontend (React) / build (push) Successful in 2m26s
Frontend (React) / lighthouse (push) Has been skipped
### Summary of Changes - Introduced `workflow_dispatch` inputs for `run_tests`, `run_lint`, `run_build`, and `run_sonar` in the CI workflows for `api-docs`, `api-gateway`, `frontend`, and `service-adapters`. - This enhancement allows for more flexible and controlled execution of CI processes, enabling developers to selectively run tests, linting, builds, and SonarQube analysis. ### Expected Results - Improved configurability of CI workflows, facilitating better management of build and testing processes based on specific needs.
This commit is contained in:
247
.gitea/workflows/all-services.yml
Normal file
247
.gitea/workflows/all-services.yml
Normal file
@@ -0,0 +1,247 @@
|
||||
name: All Services (Comprehensive)
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
run_frontend:
|
||||
description: 'Run Frontend pipeline'
|
||||
required: false
|
||||
default: true
|
||||
type: boolean
|
||||
run_api_gateway:
|
||||
description: 'Run API Gateway pipeline'
|
||||
required: false
|
||||
default: true
|
||||
type: boolean
|
||||
run_api_docs:
|
||||
description: 'Run API Docs pipeline'
|
||||
required: false
|
||||
default: true
|
||||
type: boolean
|
||||
run_service_adapters:
|
||||
description: 'Run Service Adapters pipeline'
|
||||
required: false
|
||||
default: true
|
||||
type: boolean
|
||||
run_tests_only:
|
||||
description: 'Run tests only (skip build and SonarQube)'
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
run_sonar_only:
|
||||
description: 'Run SonarQube analysis only'
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
env:
|
||||
REGISTRY: gitea.example.com
|
||||
IMAGE_PREFIX: labfusion
|
||||
|
||||
jobs:
|
||||
frontend:
|
||||
if: ${{ inputs.run_frontend }}
|
||||
runs-on: [self-hosted]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js 20
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: ./frontend
|
||||
run: npm ci
|
||||
|
||||
- name: Run tests
|
||||
if: ${{ !inputs.run_sonar_only }}
|
||||
working-directory: ./frontend
|
||||
run: npx vitest run --coverage --reporter=verbose
|
||||
|
||||
- name: Run linting
|
||||
if: ${{ !inputs.run_tests_only && !inputs.run_sonar_only }}
|
||||
working-directory: ./frontend
|
||||
run: npm run lint
|
||||
|
||||
- name: Run build
|
||||
if: ${{ !inputs.run_tests_only && !inputs.run_sonar_only }}
|
||||
working-directory: ./frontend
|
||||
run: npm run build
|
||||
|
||||
- name: Send results to SonarQube
|
||||
if: ${{ !inputs.run_tests_only }}
|
||||
run: |
|
||||
echo "Sending Frontend results to SonarQube..."
|
||||
npm install -g @sonar/scan
|
||||
sonar-scanner \
|
||||
-Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \
|
||||
-Dsonar.login=${{ secrets.SONAR_TOKEN }} \
|
||||
-Dsonar.projectKey=labfusion-frontend \
|
||||
-Dsonar.projectName=LabFusion Frontend \
|
||||
-Dsonar.sources=frontend/src \
|
||||
-Dsonar.tests=frontend/src \
|
||||
-Dsonar.sources.inclusions=**/*.js,**/*.jsx \
|
||||
-Dsonar.sources.exclusions=**/*.test.js,**/*.test.jsx,**/*.spec.js,**/*.spec.jsx,frontend/src/index.js,frontend/src/setupTests.js \
|
||||
-Dsonar.tests.inclusions=**/*.test.js,**/*.test.jsx,**/*.spec.js,**/*.spec.jsx \
|
||||
-Dsonar.coverage.exclusions=**/*.test.js,**/*.test.jsx,**/*.spec.js,**/*.spec.jsx,frontend/src/index.js,frontend/src/setupTests.js \
|
||||
-Dsonar.javascript.lcov.reportPaths=frontend/coverage/lcov.info
|
||||
|
||||
api-gateway:
|
||||
if: ${{ inputs.run_api_gateway }}
|
||||
runs-on: [self-hosted]
|
||||
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: Cache Maven dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.m2
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: ${{ runner.os }}-m2
|
||||
|
||||
- name: Run tests
|
||||
if: ${{ !inputs.run_sonar_only }}
|
||||
working-directory: ./services/api-gateway
|
||||
run: ./mvnw test
|
||||
|
||||
- name: Run SonarQube analysis
|
||||
if: ${{ !inputs.run_tests_only }}
|
||||
working-directory: ./services/api-gateway
|
||||
run: |
|
||||
./mvnw sonar:sonar \
|
||||
-Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \
|
||||
-Dsonar.login=${{ secrets.SONAR_TOKEN }} \
|
||||
-Dsonar.projectKey=labfusion-api-gateway \
|
||||
-Dsonar.projectName=LabFusion API Gateway
|
||||
|
||||
- name: Build application
|
||||
if: ${{ !inputs.run_tests_only && !inputs.run_sonar_only }}
|
||||
working-directory: ./services/api-gateway
|
||||
run: ./mvnw clean package -DskipTests
|
||||
|
||||
api-docs:
|
||||
if: ${{ inputs.run_api_docs }}
|
||||
runs-on: [self-hosted]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js 20
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: services/api-docs/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: ./services/api-docs
|
||||
run: npm ci
|
||||
|
||||
- name: Run tests
|
||||
if: ${{ !inputs.run_sonar_only }}
|
||||
working-directory: ./services/api-docs
|
||||
run: npm test
|
||||
|
||||
- name: Run linting
|
||||
if: ${{ !inputs.run_tests_only && !inputs.run_sonar_only }}
|
||||
working-directory: ./services/api-docs
|
||||
run: npm run lint
|
||||
|
||||
- name: Run build
|
||||
if: ${{ !inputs.run_tests_only && !inputs.run_sonar_only }}
|
||||
working-directory: ./services/api-docs
|
||||
run: npm run build
|
||||
|
||||
- name: Send results to SonarQube
|
||||
if: ${{ !inputs.run_tests_only }}
|
||||
run: |
|
||||
echo "Sending API Docs results to SonarQube..."
|
||||
npm install -g @sonar/scan
|
||||
sonar-scanner \
|
||||
-Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \
|
||||
-Dsonar.login=${{ secrets.SONAR_TOKEN }} \
|
||||
-Dsonar.projectKey=labfusion-api-docs \
|
||||
-Dsonar.projectName=LabFusion API Docs \
|
||||
-Dsonar.sources=services/api-docs \
|
||||
-Dsonar.tests=services/api-docs \
|
||||
-Dsonar.sources.inclusions=**/*.js \
|
||||
-Dsonar.sources.exclusions=**/*.test.js,**/*.spec.js,services/api-docs/node_modules/** \
|
||||
-Dsonar.tests.inclusions=**/*.test.js,**/*.spec.js \
|
||||
-Dsonar.coverage.exclusions=**/*.test.js,**/*.spec.js,services/api-docs/node_modules/** \
|
||||
-Dsonar.javascript.lcov.reportPaths=services/api-docs/coverage/lcov.info
|
||||
|
||||
service-adapters:
|
||||
if: ${{ inputs.run_service_adapters }}
|
||||
runs-on: [self-hosted]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python 3.11
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
cache: 'pip'
|
||||
cache-dependency-path: services/service-adapters/requirements.txt
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: ./services/service-adapters
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Run tests
|
||||
if: ${{ !inputs.run_sonar_only }}
|
||||
working-directory: ./services/service-adapters
|
||||
run: |
|
||||
python -m pytest tests/ -v --cov=. --cov-report=xml --cov-report=html
|
||||
|
||||
- name: Run linting
|
||||
if: ${{ !inputs.run_tests_only && !inputs.run_sonar_only }}
|
||||
working-directory: ./services/service-adapters
|
||||
run: |
|
||||
flake8 . --max-line-length=150
|
||||
bandit -r . -f json -o bandit-report.json
|
||||
|
||||
- name: Send results to SonarQube
|
||||
if: ${{ !inputs.run_tests_only }}
|
||||
run: |
|
||||
echo "Sending Service Adapters results to SonarQube..."
|
||||
pip install sonar-scanner
|
||||
sonar-scanner \
|
||||
-Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \
|
||||
-Dsonar.login=${{ secrets.SONAR_TOKEN }} \
|
||||
-Dsonar.projectKey=labfusion-service-adapters \
|
||||
-Dsonar.projectName=LabFusion Service Adapters \
|
||||
-Dsonar.sources=services/service-adapters \
|
||||
-Dsonar.tests=services/service-adapters \
|
||||
-Dsonar.sources.inclusions=**/*.py \
|
||||
-Dsonar.sources.exclusions=**/*.test.py,**/*.spec.py,services/service-adapters/tests/** \
|
||||
-Dsonar.tests.inclusions=**/*.test.py,**/*.spec.py \
|
||||
-Dsonar.coverage.exclusions=**/*.test.py,**/*.spec.py,services/service-adapters/tests/** \
|
||||
-Dsonar.python.coverage.reportPaths=services/service-adapters/coverage.xml
|
||||
|
||||
summary:
|
||||
runs-on: [self-hosted]
|
||||
needs: [frontend, api-gateway, api-docs, service-adapters]
|
||||
if: always()
|
||||
steps:
|
||||
- name: Pipeline Summary
|
||||
run: |
|
||||
echo "=== LabFusion Pipeline Summary ==="
|
||||
echo "Frontend: ${{ needs.frontend.result }}"
|
||||
echo "API Gateway: ${{ needs.api-gateway.result }}"
|
||||
echo "API Docs: ${{ needs.api-docs.result }}"
|
||||
echo "Service Adapters: ${{ needs.service-adapters.result }}"
|
||||
echo "=================================="
|
||||
@@ -8,6 +8,28 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'services/api-docs/**'
|
||||
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
|
||||
|
||||
@@ -8,6 +8,28 @@ on:
|
||||
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
|
||||
|
||||
@@ -8,6 +8,28 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'frontend/**'
|
||||
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
|
||||
|
||||
@@ -8,10 +8,32 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'services/service-adapters/**'
|
||||
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
|
||||
IMAGE_PREFIX: labusion
|
||||
SERVICE_NAME: service-adapters
|
||||
|
||||
jobs:
|
||||
|
||||
Reference in New Issue
Block a user