Create README.md for Integrations Organization #629
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Build and Test | |
on: | |
# Runs at every push on main | |
push: | |
branches: main | |
# Runs at every pull request | |
pull_request: | |
types: [opened, synchronize, reopened] | |
# Runs at every pull request review | |
pull_request_review: | |
types: submitted | |
# Runs manually via Run Workflow in GitHub Actions | |
workflow_dispatch: | |
# Runs every Monday at 12:00 UTC | |
schedule: | |
- cron: '0 12 * * 1' | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_IMAGE: aisk-unit-tests # Docker image name | |
DOCKER_TAG: ${{ github.sha }} # Git commit hash as the Docker tag | |
PROD_MODE: false | |
TEST_MODE: true | |
# Enable debug logging | |
ACTIONS_RUNNER_DEBUG: 'true' | |
ACTIONS_STEP_DEBUG: 'true' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Verify .dockerignore is present | |
run: | | |
if [ ! -f .dockerignore ]; then | |
echo "Error: .dockerignore file is missing." | |
exit 1 | |
else | |
echo ".dockerignore file is present." | |
fi | |
- name: Create empty .env file | |
run: touch .env | |
- name: Build Docker image with BuildKit and verbose logging | |
run: | | |
echo "Building Docker image with BuildKit and verbose logging..." | |
docker build \ | |
--progress=plain \ | |
--build-arg PROD_MODE=$PROD_MODE \ | |
--build-arg TEST_MODE=$TEST_MODE \ | |
--secret id=env,src=.env \ | |
-t "${DOCKER_IMAGE}:${DOCKER_TAG}" \ | |
. | |
- name: List Docker images | |
run: docker images | |
- name: Create .env file with secrets | |
run: | | |
echo "Creating .env file with secrets..." | |
set +x # Disable command echoing to protect secrets | |
{ | |
echo "SAMBASTUDIO_BASE_URL=${{ secrets.SAMBASTUDIO_BASE_URL }}" | |
echo "SAMBASTUDIO_PROJECT_ID=${{ secrets.SAMBASTUDIO_PROJECT_ID }}" | |
echo "SAMBASTUDIO_ENDPOINT_ID=${{ secrets.SAMBASTUDIO_ENDPOINT_ID }}" | |
echo "SAMBASTUDIO_API_KEY=${{ secrets.SAMBASTUDIO_API_KEY }}" | |
echo "SAMBASTUDIO_EMBEDDINGS_BASE_URL=${{ secrets.SAMBASTUDIO_EMBEDDINGS_BASE_URL }}" | |
echo "SAMBASTUDIO_EMBEDDINGS_PROJECT_ID=${{ secrets.SAMBASTUDIO_EMBEDDINGS_PROJECT_ID }}" | |
echo "SAMBASTUDIO_EMBEDDINGS_ENDPOINT_ID=${{ secrets.SAMBASTUDIO_EMBEDDINGS_ENDPOINT_ID }}" | |
echo "SAMBASTUDIO_EMBEDDINGS_API_KEY=${{ secrets.SAMBASTUDIO_EMBEDDINGS_API_KEY }}" | |
echo "SERPAPI_API_KEY=${{ secrets.SERPAPI_API_KEY }}" | |
echo "LVLM_API_KEY=${{ secrets.LVLM_API_KEY }}" | |
echo "SAMBANOVA_API_KEY=${{ secrets.SAMBANOVA_API_KEY }}" | |
echo "CLIP_BASE_URL=${{ secrets.CLIP_BASE_URL }}" | |
echo "CLIP_API_KEY=${{ secrets.CLIP_API_KEY }}" | |
echo "WANDB_API_KEY=${{ secrets.WANDB_API_KEY }}" | |
} >> .env | |
set -x # Re-enable command echoing | |
shell: bash | |
- name: Run tests in Docker container | |
run: | | |
echo "Running Docker tests..." | |
# Define the image name | |
IMAGE_NAME="${DOCKER_IMAGE}:${DOCKER_TAG}" | |
# Run the Docker container and execute tests | |
docker run --rm \ | |
--env-file .env \ | |
-e DOCKER_ENV=true \ | |
-e PROD_MODE=$PROD_MODE \ | |
-e TEST_MODE=$TEST_MODE \ | |
-e GIT_COMMIT_HASH=${{ github.sha }} \ | |
-v "$(pwd)/test_results:/app/test_results" \ | |
-w /app \ | |
"$IMAGE_NAME" \ | |
python tests/test_framework.py --env docker --skip-streamlit | |
env: | |
# Pass secrets as environment variables | |
SAMBASTUDIO_BASE_URL: ${{ secrets.SAMBASTUDIO_BASE_URL }} | |
SAMBASTUDIO_PROJECT_ID: ${{ secrets.SAMBASTUDIO_PROJECT_ID }} | |
SAMBASTUDIO_ENDPOINT_ID: ${{ secrets.SAMBASTUDIO_ENDPOINT_ID }} | |
SAMBASTUDIO_API_KEY: ${{ secrets.SAMBASTUDIO_API_KEY }} | |
SAMBASTUDIO_EMBEDDINGS_BASE_URL: ${{ secrets.SAMBASTUDIO_EMBEDDINGS_BASE_URL }} | |
SAMBASTUDIO_EMBEDDINGS_PROJECT_ID: ${{ secrets.SAMBASTUDIO_EMBEDDINGS_PROJECT_ID }} | |
SAMBASTUDIO_EMBEDDINGS_ENDPOINT_ID: ${{ secrets.SAMBASTUDIO_EMBEDDINGS_ENDPOINT_ID }} | |
SAMBASTUDIO_EMBEDDINGS_API_KEY: ${{ secrets.SAMBASTUDIO_EMBEDDINGS_API_KEY }} | |
SERPAPI_API_KEY: ${{ secrets.SERPAPI_API_KEY }} | |
LVLM_API_KEY: ${{ secrets.LVLM_API_KEY }} | |
SAMBANOVA_API_KEY: ${{ secrets.SAMBANOVA_API_KEY }} | |
CLIP_BASE_URL: ${{ secrets.CLIP_BASE_URL }} | |
CLIP_API_KEY: ${{ secrets.CLIP_API_KEY }} | |
WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }} |