mirror of
https://github.com/aimingmed/aimingmed-ai.git
synced 2026-02-06 23:35:28 +08:00
Merge pull request #57 from aimingmed/feature/backend-frontend-structure
test ci workflows
This commit is contained in:
commit
f140aec0c0
19
.github/workflows/build_new.yml
vendored
19
.github/workflows/build_new.yml
vendored
@ -14,11 +14,6 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
# Global environment variables accessible in the calling job
|
|
||||||
env:
|
|
||||||
PROJECT_NAME: aimingmed-ai
|
|
||||||
REPO: https://github.com/aimingmed # Updated repo for aimingmed-ai
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# This job defines the matrix and calls the reusable workflow for each image build
|
# This job defines the matrix and calls the reusable workflow for each image build
|
||||||
build:
|
build:
|
||||||
@ -45,6 +40,9 @@ jobs:
|
|||||||
- IMAGE_NAME: frontend-aimingmedai
|
- IMAGE_NAME: frontend-aimingmedai
|
||||||
BUILD_CONTEXT: ./app/frontend
|
BUILD_CONTEXT: ./app/frontend
|
||||||
DOCKERFILE: ./app/frontend/Dockerfile.test
|
DOCKERFILE: ./app/frontend/Dockerfile.test
|
||||||
|
- IMAGE_NAME: tests-aimingmedai
|
||||||
|
BUILD_CONTEXT: ./app/tests
|
||||||
|
DOCKERFILE: ./app/tests/Dockerfile
|
||||||
|
|
||||||
# Call the reusable workflow
|
# Call the reusable workflow
|
||||||
uses: ./.github/workflows/template_build.yml # Path to the reusable workflow file
|
uses: ./.github/workflows/template_build.yml # Path to the reusable workflow file
|
||||||
@ -52,7 +50,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
# Pass values from the matrix context and global env
|
# Pass values from the matrix context and global env
|
||||||
project_name: aimingmed-ai
|
project_name: aimingmed-ai
|
||||||
repo: https://github.com/aimingmed
|
image_repo: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')
|
||||||
image_name: ${{ matrix.image_config.IMAGE_NAME }}
|
image_name: ${{ matrix.image_config.IMAGE_NAME }}
|
||||||
build_context: ${{ matrix.image_config.BUILD_CONTEXT }}
|
build_context: ${{ matrix.image_config.BUILD_CONTEXT }}
|
||||||
dockerfile: ${{ matrix.image_config.DOCKERFILE }}
|
dockerfile: ${{ matrix.image_config.DOCKERFILE }}
|
||||||
@ -67,8 +65,8 @@ jobs:
|
|||||||
# Call the reusable workflow for testing
|
# Call the reusable workflow for testing
|
||||||
uses: ./.github/workflows/template_test.yml # Path to the reusable workflow file
|
uses: ./.github/workflows/template_test.yml # Path to the reusable workflow file
|
||||||
with:
|
with:
|
||||||
projectName: ${{ env.PROJECT_NAME }}
|
projectName: aimingmed-ai
|
||||||
repo: ${{ env.ARTIFACTORY_REPO }}
|
image_repo: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')
|
||||||
# Pass test environment variables as JSON string
|
# Pass test environment variables as JSON string
|
||||||
testEnvs: >
|
testEnvs: >
|
||||||
[
|
[
|
||||||
@ -91,8 +89,8 @@ jobs:
|
|||||||
"env": {
|
"env": {
|
||||||
"ENVIRONMENT": "dev",
|
"ENVIRONMENT": "dev",
|
||||||
"TESTING": "1",
|
"TESTING": "1",
|
||||||
"DEEPSEEK_API_KEY": "${{ secrets.DEEPSEEK_API_KEY }}",
|
"DEEPSEEK_API_KEY": "",
|
||||||
"TAVILY_API_KEY": "${{ secrets.TAVILY_API_KEY }}"
|
"TAVILY_API_KEY": ""
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -106,3 +104,4 @@ jobs:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
10
.github/workflows/template_build.yml
vendored
10
.github/workflows/template_build.yml
vendored
@ -10,7 +10,7 @@ on:
|
|||||||
project_name:
|
project_name:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
repo:
|
image_repo:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
image_name:
|
image_name:
|
||||||
@ -28,11 +28,7 @@ on:
|
|||||||
commit_sha:
|
commit_sha:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
secrets:
|
|
||||||
DEEPSEEK_API_KEY:
|
|
||||||
required: true
|
|
||||||
TAVILY_API_KEY:
|
|
||||||
required: true
|
|
||||||
jobs:
|
jobs:
|
||||||
build-single-image:
|
build-single-image:
|
||||||
# This job executes the build steps for the specific image configuration passed via inputs
|
# This job executes the build steps for the specific image configuration passed via inputs
|
||||||
@ -76,7 +72,7 @@ jobs:
|
|||||||
# Define tags consistently using inputs
|
# Define tags consistently using inputs
|
||||||
id: tags
|
id: tags
|
||||||
run: |
|
run: |
|
||||||
echo "image_repo_path=ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')/${{ inputs.image_name }}" >> $GITHUB_OUTPUT
|
echo "image_repo_path=${{ inputs.image_repo }}/${{ inputs.image_name }}" >> $GITHUB_OUTPUT
|
||||||
echo "tag_build_id=${{ inputs.build_id }}" >> $GITHUB_OUTPUT
|
echo "tag_build_id=${{ inputs.build_id }}" >> $GITHUB_OUTPUT
|
||||||
echo "tag_commit_sha=${{ inputs.commit_sha }}" >> $GITHUB_OUTPUT
|
echo "tag_commit_sha=${{ inputs.commit_sha }}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
|||||||
14
.github/workflows/template_test.yml
vendored
14
.github/workflows/template_test.yml
vendored
@ -6,7 +6,7 @@ on:
|
|||||||
projectName:
|
projectName:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
repo:
|
image_repo:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
images: # JSON string defining services for compose
|
images: # JSON string defining services for compose
|
||||||
@ -36,13 +36,14 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
default: results.xml
|
default: results.xml
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
compose_and_test:
|
compose_and_test:
|
||||||
name: Compose Services and Run Tests
|
name: Compose Services and Run Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
# Env vars needed for compose file generation/execution
|
# Env vars needed for compose file generation/execution
|
||||||
REPO: ${{ inputs.repo }}
|
IMAGE_REPO: ${{ inputs.image_repo }}
|
||||||
PROJECT_NAME: ${{ inputs.projectName }}
|
PROJECT_NAME: ${{ inputs.projectName }}
|
||||||
TAG: ${{ github.run_id }} # Use run_id as the build tag
|
TAG: ${{ github.run_id }} # Use run_id as the build tag
|
||||||
|
|
||||||
@ -64,8 +65,12 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
# Load Inputs (parse JSON strings)
|
# Load Inputs (parse JSON strings)
|
||||||
$imagesJson = '${{ inputs.images }}'
|
$imagesJson = '${{ inputs.images }}'
|
||||||
|
$deepseekApiKey = '${{ secrets.DEEPSEEK_API_KEY }}'
|
||||||
|
$tavilyApiKey = '${{ secrets.TAVILY_API_KEY }}'
|
||||||
# Substitute secrets *before* parsing JSON using environment variables
|
# Substitute secrets *before* parsing JSON using environment variables
|
||||||
# Be very careful with escaping if secrets contain special JSON characters
|
# Be very careful with escaping if secrets contain special JSON characters
|
||||||
|
$imagesJson = $imagesJson -replace '"DEEPSEEK_API_KEY": ""', "`"DEEPSEEK_API_KEY`": `"$deepseekApiKey`""
|
||||||
|
$imagesJson = $imagesJson -replace '"TAVILY_API_KEY": ""', "`"TAVILY_API_KEY`": `"$tavilyApiKey`""
|
||||||
|
|
||||||
Write-Host "Substituted Images JSON: $imagesJson" # Debugging - remove sensitive info if public
|
Write-Host "Substituted Images JSON: $imagesJson" # Debugging - remove sensitive info if public
|
||||||
$images = $imagesJson | ConvertFrom-Json
|
$images = $imagesJson | ConvertFrom-Json
|
||||||
@ -80,7 +85,8 @@ jobs:
|
|||||||
foreach ($img in $images) {
|
foreach ($img in $images) {
|
||||||
$serviceName = $img.name
|
$serviceName = $img.name
|
||||||
$svc = @{}
|
$svc = @{}
|
||||||
$svc.image = "${{ env.REPO }}/${{ env.PROJECT_NAME }}/$($serviceName):${{ env.TAG }}" # Use run_id tag
|
$svc.image = "${{ env.IMAGE_REPO }}/$($serviceName):${{ env.TAG }}" # Use run_id tag
|
||||||
|
|
||||||
if ($img.depends_on) {
|
if ($img.depends_on) {
|
||||||
$svc.depends_on = $img.depends_on
|
$svc.depends_on = $img.depends_on
|
||||||
}
|
}
|
||||||
@ -159,7 +165,7 @@ jobs:
|
|||||||
$ENV_ARGS \
|
$ENV_ARGS \
|
||||||
-v "$STAGING_DIR:$RESULTS_PATH" \
|
-v "$STAGING_DIR:$RESULTS_PATH" \
|
||||||
--rm \
|
--rm \
|
||||||
"${{ inputs.repo }}/${{ inputs.projectName }}/${{ inputs.testContainerName }}:${{ github.run_id }}" \
|
"${{ env.IMAGE_REPO }}/$($serviceName)/${{ inputs.testContainerName }}:${{ github.run_id }}" \
|
||||||
"$test_dir"
|
"$test_dir"
|
||||||
# Add error handling if needed (e.g., exit script if a test run fails)
|
# Add error handling if needed (e.g., exit script if a test run fails)
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
|||||||
0
app/tests/tests/.gitkeep
Normal file
0
app/tests/tests/.gitkeep
Normal file
0
app/tests/tests/integration/backend/.gitkeep
Normal file
0
app/tests/tests/integration/backend/.gitkeep
Normal file
Loading…
x
Reference in New Issue
Block a user