-
Notifications
You must be signed in to change notification settings - Fork 2
134 lines (112 loc) · 4.69 KB
/
test.yml
File metadata and controls
134 lines (112 loc) · 4.69 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Test
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run tests with coverage
run: go test ./... -v -count=1 -coverprofile=coverage.out
- name: Coverage summary
run: |
total=$(go tool cover -func=coverage.out | tail -1 | awk '{print $NF}')
echo "## Test Coverage" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "**Total: ${total}**" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "| Package | Coverage |" >> "$GITHUB_STEP_SUMMARY"
echo "|---------|----------|" >> "$GITHUB_STEP_SUMMARY"
go tool cover -func=coverage.out | grep -v "total:" | awk -F'\t+' '{print $1, $NF}' | sort -u -t' ' -k1,1 | while read -r pkg cov; do
echo "| \`${pkg}\` | ${cov} |" >> "$GITHUB_STEP_SUMMARY"
done
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run e2e tests
run: go test ./e2e/ -v -count=1 -timeout=120s
integration:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install ios-webkit-debug-proxy
run: brew install ios-webkit-debug-proxy
- name: Run all tests with integration tag and coverage
run: go test -tags=integration ./... -v -count=1 -timeout=120s -coverprofile=coverage-integration.out
- name: Integration coverage summary
run: |
total=$(go tool cover -func=coverage-integration.out | tail -1 | awk '{print $NF}')
echo "## Integration Test Coverage (includes all tests)" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "**Total: ${total}**" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "| Package | Coverage |" >> "$GITHUB_STEP_SUMMARY"
echo "|---------|----------|" >> "$GITHUB_STEP_SUMMARY"
go tool cover -func=coverage-integration.out | grep -v "total:" | awk -F'\t+' '{print $1, $NF}' | sort -u -t' ' -k1,1 | while read -r pkg cov; do
echo "| \`${pkg}\` | ${cov} |" >> "$GITHUB_STEP_SUMMARY"
done
simulator:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install ios-webkit-debug-proxy
run: brew install ios-webkit-debug-proxy
- name: Select Xcode with iOS 18 runtime
run: |
# iOS 19+ has breaking WebKit Inspector Protocol changes (many
# domains return "not found"). Use an older Xcode/iOS for testing.
echo "Available Xcode versions:"
ls -d /Applications/Xcode*.app 2>/dev/null || true
echo ""
# Prefer Xcode 16 (iOS 18) over Xcode 17 (iOS 19)
for xcode in /Applications/Xcode_16*.app; do
if [ -d "$xcode" ]; then
echo "Selecting $xcode"
sudo xcode-select -s "$xcode"
break
fi
done
echo "Active Xcode: $(xcode-select -p)"
echo "Available runtimes:"
xcrun simctl list runtimes
- name: Boot iOS Simulator and start iwdp
run: |
eval "$(./scripts/sim-setup.sh)"
echo "IWDP_SIM_WS_URL=$IWDP_SIM_WS_URL" >> "$GITHUB_ENV"
- name: Run simulator tests with coverage
run: go test -tags=simulator ./... -v -count=1 -timeout=300s -coverprofile=coverage-simulator.out
- name: Simulator coverage summary
if: always()
run: |
if [ -f coverage-simulator.out ]; then
total=$(go tool cover -func=coverage-simulator.out | tail -1 | awk '{print $NF}')
echo "## Simulator Test Coverage" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "**Total: ${total}**" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "| Package | Coverage |" >> "$GITHUB_STEP_SUMMARY"
echo "|---------|----------|" >> "$GITHUB_STEP_SUMMARY"
go tool cover -func=coverage-simulator.out | grep -v "total:" | awk -F'\t+' '{print $1, $NF}' | sort -u -t' ' -k1,1 | while read -r pkg cov; do
echo "| \`${pkg}\` | ${cov} |" >> "$GITHUB_STEP_SUMMARY"
done
fi
- name: Teardown simulator
if: always()
run: ./scripts/sim-setup.sh --teardown