test(performance): add cold start benchmarking infrastructure #700
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
| # Performs a full test of the package within production environment. | |
| name: CI | End-to-End Runpod Python Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| e2e-build: | |
| name: Build and push mock-worker Docker image | |
| if: github.repository == 'runpod/runpod-python' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| docker_tag: ${{ steps.output_docker_tag.outputs.docker_tag }} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Clone and patch mock-worker | |
| run: | | |
| git clone https://github.com/runpod-workers/mock-worker | |
| GIT_SHA=${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} | |
| echo "git+https://github.com/runpod/runpod-python.git@$GIT_SHA" > mock-worker/builder/requirements.txt | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Define Docker Tag | |
| id: docker_tag | |
| run: | | |
| DOCKER_TAG=${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} | |
| echo "DOCKER_TAG=$(echo $DOCKER_TAG | cut -c 1-7)" >> $GITHUB_ENV | |
| - name: Set Docker Tag as Output | |
| id: output_docker_tag | |
| run: echo "docker_tag=${{ env.DOCKER_TAG }}" >> $GITHUB_OUTPUT | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./mock-worker | |
| file: ./mock-worker/Dockerfile | |
| push: true | |
| tags: ${{ vars.DOCKERHUB_REPO }}/${{ vars.DOCKERHUB_IMG }}:${{ env.DOCKER_TAG }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| test: | |
| name: Run End-to-End Tests | |
| runs-on: ubuntu-latest | |
| needs: [e2e-build] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run Tests | |
| id: run-tests | |
| uses: runpod/[email protected] | |
| with: | |
| image-tag: ${{ vars.DOCKERHUB_REPO }}/${{ vars.DOCKERHUB_IMG }}:${{ needs.e2e-build.outputs.docker_tag }} | |
| runpod-api-key: ${{ secrets.RUNPOD_API_KEY }} | |
| request-timeout: 1200 | |
| - name: Verify Tests | |
| env: | |
| TOTAL_TESTS: ${{ steps.run-tests.outputs.total-tests }} | |
| SUCCESSFUL_TESTS: ${{ steps.run-tests.outputs.succeeded }} | |
| run: | | |
| echo "Total tests: $TOTAL_TESTS" | |
| echo "Successful tests: $SUCCESSFUL_TESTS" | |
| if [ "$TOTAL_TESTS" != "$SUCCESSFUL_TESTS" ]; then | |
| exit 1 | |
| fi |