|
1 | | -# Performs a full test of the package within production environment. |
2 | | - |
3 | | -name: CI | End-to-End RunPod Python Tests |
4 | | - |
| 1 | +name: CI-e2e |
5 | 2 | on: |
6 | 3 | push: |
7 | | - branches: |
8 | | - - main |
9 | | - |
| 4 | + branches: [main] |
10 | 5 | pull_request: |
11 | | - branches: |
12 | | - - main |
13 | | - |
| 6 | + branches: [main] |
14 | 7 | workflow_dispatch: |
15 | 8 |
|
16 | 9 | jobs: |
17 | | - e2e-build: |
18 | | - name: Build and push mock-worker Docker image |
| 10 | + e2e: |
| 11 | + if: github.repository == 'runpod/runpod-python' |
19 | 12 | runs-on: ubuntu-latest |
20 | | - outputs: |
21 | | - docker_tag: ${{ steps.output_docker_tag.outputs.docker_tag }} |
22 | | - |
| 13 | + timeout-minutes: 15 |
23 | 14 | steps: |
24 | | - - name: Checkout Repo |
25 | | - uses: actions/checkout@v4 |
26 | | - with: |
27 | | - fetch-depth: 2 |
28 | | - |
29 | | - - name: Clone and patch mock-worker |
30 | | - run: | |
31 | | - git clone https://github.com/runpod-workers/mock-worker |
32 | | - GIT_SHA=${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} |
33 | | - echo "git+https://github.com/runpod/runpod-python.git@$GIT_SHA" > mock-worker/builder/requirements.txt |
| 15 | + - uses: actions/checkout@v5 |
34 | 16 |
|
35 | | - - name: Set up QEMU |
36 | | - uses: docker/setup-qemu-action@v3 |
| 17 | + - uses: astral-sh/setup-uv@v6 |
37 | 18 |
|
38 | | - - name: Set up Docker Buildx |
39 | | - uses: docker/setup-buildx-action@v3 |
40 | | - |
41 | | - - name: Login to Docker Hub |
42 | | - uses: docker/login-action@v3 |
| 19 | + - uses: actions/setup-python@v5 |
43 | 20 | with: |
44 | | - username: ${{ secrets.DOCKERHUB_USERNAME }} |
45 | | - password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 21 | + python-version: "3.12" |
46 | 22 |
|
47 | | - - name: Define Docker Tag |
48 | | - id: docker_tag |
| 23 | + - name: Install dependencies |
49 | 24 | run: | |
50 | | - DOCKER_TAG=${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} |
51 | | - echo "DOCKER_TAG=$(echo $DOCKER_TAG | cut -c 1-7)" >> $GITHUB_ENV |
52 | | -
|
53 | | - - name: Set Docker Tag as Output |
54 | | - id: output_docker_tag |
55 | | - run: echo "::set-output name=docker_tag::${{ env.DOCKER_TAG }}" |
56 | | - |
57 | | - - name: Build and push Docker image |
58 | | - env: |
59 | | - DOCKERHUB_REPO: ${{ vars.DOCKERHUB_REPO }} |
60 | | - DOCKERHUB_IMG: ${{ vars.DOCKERHUB_IMG }} |
| 25 | + uv venv |
| 26 | + source .venv/bin/activate |
| 27 | + uv pip install -e ".[test]" --quiet || uv pip install -e . |
| 28 | + uv pip install runpod-flash pytest pytest-asyncio pytest-timeout pytest-rerunfailures httpx |
| 29 | + uv pip install -e . --reinstall --no-deps |
| 30 | + python -c "import runpod; print(f'runpod: {runpod.__version__} from {runpod.__file__}')" |
| 31 | +
|
| 32 | + - name: Run e2e tests |
61 | 33 | run: | |
62 | | - docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} |
63 | | - docker build -t $DOCKERHUB_REPO/$DOCKERHUB_IMG:${{ env.DOCKER_TAG }} -f mock-worker/Dockerfile mock-worker |
64 | | - docker push $DOCKERHUB_REPO/$DOCKERHUB_IMG:${{ env.DOCKER_TAG }} |
65 | | -
|
66 | | - test: |
67 | | - name: Run End-to-End Tests |
68 | | - runs-on: ubuntu-latest |
69 | | - needs: [e2e-build] |
70 | | - |
71 | | - steps: |
72 | | - - uses: actions/checkout@v4 |
73 | | - |
74 | | - - name: Run Tests |
75 | | - id: run-tests |
76 | | - uses: runpod/runpod-test-runner@v2.1.0 |
77 | | - with: |
78 | | - image-tag: ${{ vars.DOCKERHUB_REPO }}/${{ vars.DOCKERHUB_IMG }}:${{ needs.e2e-build.outputs.docker_tag }} |
79 | | - runpod-api-key: ${{ secrets.RUNPOD_API_KEY }} |
80 | | - request-timeout: 1200 |
81 | | - |
82 | | - - name: Verify Tests |
| 34 | + source .venv/bin/activate |
| 35 | + pytest tests/e2e/ -v -p no:xdist --timeout=600 --reruns 1 --reruns-delay 5 --log-cli-level=INFO -o "addopts=" |
83 | 36 | env: |
84 | | - TOTAL_TESTS: ${{ steps.run-tests.outputs.total-tests }} |
85 | | - SUCCESSFUL_TESTS: ${{ steps.run-tests.outputs.succeeded }} |
86 | | - run: | |
87 | | - echo "Total tests: $TOTAL_TESTS" |
88 | | - echo "Successful tests: $SUCCESSFUL_TESTS" |
89 | | - if [ "$TOTAL_TESTS" != "$SUCCESSFUL_TESTS" ]; then |
90 | | - exit 1 |
91 | | - fi |
| 37 | + RUNPOD_API_KEY: ${{ secrets.RUNPOD_API_KEY }} |
| 38 | + RUNPOD_SDK_GIT_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} |
0 commit comments