Test Local Upload #10
This file contains hidden or 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: Test Local Upload | |
| on: | |
| workflow_run: | |
| workflows: ["Docker Build (Local)"] | |
| types: | |
| - completed | |
| jobs: | |
| Test-Local-Uploads: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| env: | |
| COMPOSE_FILE: ./docker-compose.yml | |
| REGISTRY_PREFIX: docker.io/library | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true # Ensure we get the submodule info | |
| - name: Set repository name | |
| run: echo "REPO_NAME=$(basename $GITHUB_WORKSPACE)" >> $GITHUB_ENV | |
| - name: Cache test data | |
| uses: actions/cache@v4 | |
| id: test-data-cache | |
| with: | |
| path: test/test_data | |
| key: test-data-${{ hashFiles('.gitmodules') }} | |
| restore-keys: | | |
| test-data- | |
| - name: Get test data if not cached | |
| if: steps.test-data-cache.outputs.cache-hit != 'true' | |
| run: | | |
| make get-test-data | |
| - name: Cache Docker images | |
| uses: actions/cache@v4 | |
| id: docker-cache | |
| with: | |
| path: | | |
| mongo.tar | |
| api.tar | |
| handler.tar | |
| ui.tar | |
| key: docker-local-images-${{ github.event.workflow_run.head_sha }} | |
| restore-keys: | | |
| docker-local-images- | |
| - name: Load images | |
| if: steps.docker-cache.outputs.cache-hit == 'true' | |
| run: | | |
| # Load images and verify they were loaded successfully | |
| docker load < mongo.tar || exit 1 | |
| docker load < api.tar || exit 1 | |
| docker load < handler.tar || exit 1 | |
| docker load < ui.tar || exit 1 | |
| # Verify images exist | |
| docker image inspect mongo || exit 1 | |
| docker image inspect ${REGISTRY_PREFIX}/${REPO_NAME}-api:latest || exit 1 | |
| docker image inspect ${REGISTRY_PREFIX}/${REPO_NAME}-handler:latest || exit 1 | |
| docker image inspect ${REGISTRY_PREFIX}/${REPO_NAME}-ui:latest || exit 1 | |
| - name: Start services | |
| run: | | |
| # Create and set permissions for temp directory | |
| mkdir -p /tmp/ezbids-workdir | |
| chmod 770 /tmp/ezbids-workdir | |
| # Start services using our tagged images | |
| docker compose -f ${{ env.COMPOSE_FILE }} up -d | |
| - name: Wait for services to be ready | |
| run: | | |
| # Wait for MongoDB | |
| timeout 60 bash -c 'until docker compose -f ${{ env.COMPOSE_FILE }} exec -T mongo mongosh --eval "db.adminCommand(\"ping\")" > /dev/null 2>&1; do sleep 2; done' | |
| # Wait for API | |
| timeout 60 bash -c 'until curl -s http://localhost:8082/health > /dev/null; do sleep 2; done' | |
| # Wait for UI | |
| timeout 60 bash -c 'until curl -s http://localhost:3000 > /dev/null; do sleep 2; done' | |
| - name: Install uv | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Verify uv installation | |
| run: uv --version | |
| - name: Setup test environment | |
| run: | | |
| cd test | |
| make setup-test | |
| - name: Run upload test | |
| run: | | |
| cd test | |
| make test-upload | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| docker compose -f ${{ env.COMPOSE_FILE }} down | |
| docker system prune -f |