|
| 1 | +name: E2E Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - 'drift/**' |
| 8 | + - '.github/workflows/e2e.yml' |
| 9 | + pull_request: |
| 10 | + branches: [main] |
| 11 | + paths: |
| 12 | + - 'drift/**' |
| 13 | + - '.github/workflows/e2e.yml' |
| 14 | + workflow_dispatch: {} |
| 15 | + |
| 16 | +jobs: |
| 17 | + e2e: |
| 18 | + name: E2E Tests - ${{ matrix.library }} |
| 19 | + runs-on: ubuntu-latest |
| 20 | + timeout-minutes: 30 |
| 21 | + strategy: |
| 22 | + fail-fast: false |
| 23 | + max-parallel: 6 |
| 24 | + matrix: |
| 25 | + library: [flask, fastapi, django, redis, requests, httpx, psycopg, psycopg2] |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: Install uv |
| 31 | + uses: astral-sh/setup-uv@v4 |
| 32 | + with: |
| 33 | + version: "latest" |
| 34 | + |
| 35 | + - name: Setup Python |
| 36 | + run: uv python install 3.12 |
| 37 | + |
| 38 | + - name: Setup Docker Buildx |
| 39 | + uses: docker/setup-buildx-action@v3 |
| 40 | + with: |
| 41 | + driver: docker |
| 42 | + |
| 43 | + - name: Install SDK dependencies |
| 44 | + run: uv sync --all-extras |
| 45 | + |
| 46 | + - name: Build SDK |
| 47 | + run: uv build |
| 48 | + |
| 49 | + - name: Verify SDK build |
| 50 | + run: | |
| 51 | + ls -la dist/ || (echo "dist folder not found!" && exit 1) |
| 52 | + test -f dist/*.whl || (echo "SDK build incomplete!" && exit 1) |
| 53 | +
|
| 54 | + - name: Get latest Tusk CLI version |
| 55 | + id: tusk-version |
| 56 | + run: | |
| 57 | + VERSION=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ |
| 58 | + "https://api.github.com/repos/Use-Tusk/tusk-drift-cli/releases/latest" \ |
| 59 | + | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') |
| 60 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 61 | + echo "Latest Tusk CLI version: $VERSION" |
| 62 | +
|
| 63 | + - name: Build base image |
| 64 | + env: |
| 65 | + DOCKER_DEFAULT_PLATFORM: linux/amd64 |
| 66 | + run: | |
| 67 | + docker build \ |
| 68 | + --build-arg TUSK_CLI_VERSION=${{ steps.tusk-version.outputs.version }} \ |
| 69 | + -t python-e2e-base:latest \ |
| 70 | + -f drift/instrumentation/e2e_common/Dockerfile.base \ |
| 71 | + . |
| 72 | +
|
| 73 | + - name: Run E2E tests for ${{ matrix.library }} |
| 74 | + env: |
| 75 | + DOCKER_DEFAULT_PLATFORM: linux/amd64 |
| 76 | + TUSK_CLI_VERSION: ${{ steps.tusk-version.outputs.version }} |
| 77 | + run: | |
| 78 | + chmod +x ./drift/instrumentation/${{ matrix.library }}/e2e-tests/run.sh |
| 79 | + cd ./drift/instrumentation/${{ matrix.library }}/e2e-tests && ./run.sh 8000 |
| 80 | +
|
| 81 | + - name: Cleanup Docker resources |
| 82 | + if: always() |
| 83 | + run: | |
| 84 | + # Stop all running containers |
| 85 | + docker ps -aq | xargs -r docker stop || true |
| 86 | + docker ps -aq | xargs -r docker rm || true |
| 87 | + # Clean up volumes |
| 88 | + docker volume prune -f || true |
| 89 | + # Clean up networks |
| 90 | + docker network prune -f || true |
0 commit comments