This commit is contained in:
leehk 2025-04-16 17:30:03 +08:00
parent 9189738e59
commit d5e284be3e

View File

@ -50,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
image_repo: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]') 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 }}
@ -61,55 +61,51 @@ jobs:
test: test:
name: Run Integration Tests name: Run Integration Tests
needs: build # Ensure this job runs after the build job needs: build # Ensure this job runs after the build job
runs-on: ubuntu-latest # Specify the runner
# Define necessary permissions if needed (e.g., for GitHub Packages) # Define necessary permissions if needed (e.g., for GitHub Packages)
permissions: permissions:
contents: read contents: read
packages: write # If pushing to GitHub Packages registry packages: write # If pushing to GitHub Packages registry
steps: # Call the reusable workflow for testing
- name: Set Image Repo uses: ./.github/workflows/template_test.yml # Path to the reusable workflow file
id: set_image_repo with:
run: echo "image_repo=ghcr.io/$(echo "$GITHUB_REPOSITORY" | tr '[A-Z]' '[a-z]')" >> $GITHUB_OUTPUT projectName: aimingmed-ai
shell: bash image_repo: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')
# Call the reusable workflow for testing testContainerName: tests-aimingmedai
- uses: .github/workflows/template_test.yml # Path to the reusable workflow file # Pass test environment variables as JSON string
with: testEnvs: >
projectName: aimingmed-ai [
image_repo: ${{ steps.set_image_repo.outputs.image_repo }} "FRONTEND_URL=http://frontend:80",
testContainerName: tests-aimingmedai "BACKEND_URL=http://backend:80",
# Pass test environment variables as JSON string "ENVIRONMENT=dev",
testEnvs: > "TESTING=1",
[ ]
"FRONTEND_URL=http://frontend:80", # Pass test directories as JSON string
"BACKEND_URL=http://backend:80", tests: >
"ENVIRONMENT=dev", [
"TESTING=1", "tests/integration/backend",
] ]
# Pass test directories as JSON string # Pass image definitions for compose setup as JSON string
tests: > # Sensitive values should be passed via secrets and referenced within the template
[ images: >
"tests/integration/backend", [
] {
# Pass image definitions for compose setup as JSON string "name": "backend-aimingmedai",
images: > "env": {
[ "ENVIRONMENT": "dev",
{ "TESTING": "1",
"name": "backend-aimingmedai", "DEEPSEEK_API_KEY": "",
"env": { "TAVILY_API_KEY": ""
"ENVIRONMENT": "dev",
"TESTING": "1", }
"DEEPSEEK_API_KEY": "", },
"TAVILY_API_KEY": "" {
"name": "frontend-aimingmedai",
"depends_on": ["backend-aimingmedai"],
"env": {
"ENVIRONMENT": "dev",
"TESTING": "1",
"LOG_LEVEL": "DEBUG"
}
}
]
}
},
{
"name": "frontend-aimingmedai",
"depends_on": ["backend-aimingmedai"],
"env": {
"ENVIRONMENT": "dev",
"TESTING": "1",
"LOG_LEVEL": "DEBUG"
}
}
]