Repository navigation
86 lines (74 loc) · 2.45 KB
/
Copy pathe2e-tests.yml
File metadata and controls
86 lines (74 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# E2E Tests for analytics-kotlin
# Copy this file to: analytics-kotlin/.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 SDK and e2e-cli
# 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: ubuntu-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 Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- 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-kotlin-http.patch
echo "HTTP patch applied successfully"
- name: Build Kotlin SDK and e2e-cli
working-directory: sdk
run: ./gradlew :e2e-cli:jar
- name: Find e2e-cli jar
id: find-jar
working-directory: sdk
run: |
JAR_PATH=$(find e2e-cli/build/libs -name "e2e-cli-*.jar" | head -1)
echo "jar_path=$JAR_PATH" >> $GITHUB_OUTPUT
- name: Run E2E tests
working-directory: sdk-e2e-tests
run: |
./scripts/run-tests.sh \
--sdk-dir "${{ github.workspace }}/sdk/e2e-cli" \
--cli "java -jar ${{ github.workspace }}/sdk/${{ steps.find-jar.outputs.jar_path }}" \
--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