This commit is contained in:
leehk 2025-04-16 17:22:25 +08:00
parent 13d5ab4098
commit bb27bfcfee

View File

@ -61,51 +61,55 @@ 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
# Call the reusable workflow for testing steps:
uses: ./.github/workflows/template_test.yml # Path to the reusable workflow file - name: Set Image Repo
with: id: set_image_repo
projectName: aimingmed-ai run: echo "image_repo=ghcr.io/$(echo "$GITHUB_REPOSITORY" | tr '[A-Z]' '[a-z]')" >> $GITHUB_OUTPUT
image_repo: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]') shell: bash
testContainerName: tests-aimingmedai # Call the reusable workflow for testing
# Pass test environment variables as JSON string - uses: ./.github/workflows/template_test.yml # Path to the reusable workflow file
testEnvs: > with:
[ projectName: aimingmed-ai
"FRONTEND_URL=http://frontend:80", image_repo: ${{ steps.set_image_repo.outputs.image_repo }}
"BACKEND_URL=http://backend:80", testContainerName: tests-aimingmedai
"ENVIRONMENT=dev", # Pass test environment variables as JSON string
"TESTING=1", testEnvs: >
] [
# Pass test directories as JSON string "FRONTEND_URL=http://frontend:80",
tests: > "BACKEND_URL=http://backend:80",
[ "ENVIRONMENT=dev",
"tests/integration/backend", "TESTING=1",
] ]
# Pass image definitions for compose setup as JSON string # Pass test directories as JSON string
# Sensitive values should be passed via secrets and referenced within the template tests: >
images: > [
[ "tests/integration/backend",
{ ]
"name": "backend-aimingmedai", # Pass image definitions for compose setup as JSON string
"env": { images: >
"ENVIRONMENT": "dev", [
"TESTING": "1", {
"DEEPSEEK_API_KEY": "", "name": "backend-aimingmedai",
"TAVILY_API_KEY": "" "env": {
"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"
}
}
]