|
| 1 | +# E2E Tests for analytics-python |
| 2 | +# Copy this file to: analytics-python/.github/workflows/e2e-tests.yml |
| 3 | +# |
| 4 | +# This workflow: |
| 5 | +# 1. Checks out the SDK and sdk-e2e-tests repos |
| 6 | +# 2. Installs the SDK and e2e-cli dependencies |
| 7 | +# 3. Runs the e2e test suite |
| 8 | + |
| 9 | +name: E2E Tests |
| 10 | + |
| 11 | +on: |
| 12 | + push: |
| 13 | + branches: [main, master] |
| 14 | + pull_request: |
| 15 | + branches: [main, master] |
| 16 | + workflow_dispatch: |
| 17 | + inputs: |
| 18 | + e2e_tests_ref: |
| 19 | + description: 'Branch or ref of sdk-e2e-tests to use' |
| 20 | + required: false |
| 21 | + default: 'main' |
| 22 | + |
| 23 | +jobs: |
| 24 | + e2e-tests: |
| 25 | + # Skip on fork PRs where repo secrets aren't available |
| 26 | + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} |
| 27 | + runs-on: ubuntu-latest |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: Checkout SDK |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + path: sdk |
| 34 | + |
| 35 | + - name: Checkout sdk-e2e-tests |
| 36 | + uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + repository: segmentio/sdk-e2e-tests |
| 39 | + ref: ${{ inputs.e2e_tests_ref || 'main' }} |
| 40 | + token: ${{ secrets.E2E_TESTS_TOKEN }} |
| 41 | + path: sdk-e2e-tests |
| 42 | + |
| 43 | + - name: Setup Python |
| 44 | + uses: actions/setup-python@v5 |
| 45 | + with: |
| 46 | + python-version: '3.11' |
| 47 | + |
| 48 | + - name: Setup Node.js |
| 49 | + uses: actions/setup-node@v4 |
| 50 | + with: |
| 51 | + node-version: '20' |
| 52 | + |
| 53 | + - name: Install Python SDK |
| 54 | + working-directory: sdk |
| 55 | + run: pip install -e . |
| 56 | + |
| 57 | + - name: Install e2e-cli dependencies |
| 58 | + working-directory: sdk/e2e-cli |
| 59 | + run: pip install -e . |
| 60 | + |
| 61 | + - name: Run E2E tests |
| 62 | + working-directory: sdk-e2e-tests |
| 63 | + run: | |
| 64 | + ./scripts/run-tests.sh \ |
| 65 | + --sdk-dir "${{ github.workspace }}/sdk/e2e-cli" \ |
| 66 | + --cli "e2e-cli" |
| 67 | +
|
| 68 | + - name: Upload test results |
| 69 | + if: always() |
| 70 | + uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: e2e-test-results |
| 73 | + path: sdk-e2e-tests/test-results/ |
| 74 | + if-no-files-found: ignore |
0 commit comments