update release script #51
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
| # E2E Tests for analytics-swift | |
| # Copy this file to: analytics-swift/.github/workflows/e2e-tests.yml | |
| # | |
| # This workflow: | |
| # 1. Checks out the SDK and sdk-e2e-tests repos | |
| # 2. Applies the HTTP patch to allow mock server testing | |
| # 3. Builds the e2e-cli (separate SPM package) | |
| # 4. Runs the e2e test suite | |
| name: E2E Tests | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| workflow_dispatch: | |
| inputs: | |
| e2e_tests_ref: | |
| description: 'Branch or ref of sdk-e2e-tests to use' | |
| required: false | |
| default: 'main' | |
| jobs: | |
| e2e-tests: | |
| # Skip on fork PRs where repo secrets aren't available | |
| if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout SDK | |
| uses: actions/checkout@v4 | |
| with: | |
| path: sdk | |
| - name: Checkout sdk-e2e-tests | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: segmentio/sdk-e2e-tests | |
| ref: ${{ inputs.e2e_tests_ref || 'main' }} | |
| token: ${{ secrets.E2E_TESTS_TOKEN }} | |
| path: sdk-e2e-tests | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Apply HTTP patch for testing | |
| working-directory: sdk | |
| run: | | |
| git apply ../sdk-e2e-tests/patches/analytics-swift-http.patch | |
| echo "HTTP patch applied successfully" | |
| - name: Build e2e-cli | |
| working-directory: sdk/e2e-cli | |
| run: swift build | |
| - name: Run E2E tests | |
| working-directory: sdk-e2e-tests | |
| run: | | |
| ./scripts/run-tests.sh \ | |
| --sdk-dir "${{ github.workspace }}/sdk/e2e-cli" \ | |
| --cli "${{ github.workspace }}/sdk/e2e-cli/.build/debug/E2ECLI" \ | |
| --sdk-path "${{ github.workspace }}/sdk" | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: e2e-test-results | |
| path: sdk-e2e-tests/test-results/ | |
| if-no-files-found: ignore |