-
Notifications
You must be signed in to change notification settings - Fork 297
182 lines (161 loc) · 6.58 KB
/
_test_examples.yml
File metadata and controls
182 lines (161 loc) · 6.58 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: _test_examples
on:
workflow_call:
inputs:
component:
type: string
required: true
description: "Component to test (should be 'examples-suite')"
task:
type: string
required: true
description: "Task to run (e.g., 'examples-rust', 'examples-go', 'examples-node')"
permissions:
contents: read
security-events: write
jobs:
run:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Skip noop
if: inputs.component == 'noop'
run: echo "No changes detected, skipping tests"
- name: Setup Rust with cache for examples
if: inputs.component == 'examples-suite'
uses: ./.github/actions/utils/setup-rust-with-cache
with:
cache-targets: false # Only cache registry and git deps, not target dir (sccache handles that)
save-cache: "false" # Only builds server+examples, let Rust test job save comprehensive cache
- name: Setup Node with cache for examples
if: inputs.component == 'examples-suite'
uses: ./.github/actions/utils/setup-node-with-cache
with:
node-version: "23"
cache-dependency-path: examples/node/package-lock.json
workspace: examples/node
- name: Setup Python
if: inputs.component == 'examples-suite'
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Cache pip
if: inputs.component == 'examples-suite'
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ hashFiles('foreign/python/pyproject.toml') }}
- name: Setup Java with cache for examples
if: inputs.component == 'examples-suite' && inputs.task == 'examples-java'
uses: ./.github/actions/utils/setup-java-with-cache
with:
gradle-cache-disabled: "true"
- name: Setup Go with cache for examples
if: inputs.component == 'examples-suite' && inputs.task == 'examples-go'
uses: ./.github/actions/utils/setup-go-with-cache
with:
enabled: "false"
cache-dependency-path: examples/go/go.sum
download-deps: "false"
- name: Build common binaries for all examples
if: inputs.component == 'examples-suite'
run: |
echo "Building common binaries for all examples tests..."
echo "Current directory: $(pwd)"
# Build server (needed by both Rust and Go examples)
echo "Building iggy-server..."
cargo build --locked --bin iggy-server
# For Rust examples, also build CLI and example binaries
if [[ "${{ inputs.task }}" == "examples-rust" ]]; then
echo "Building additional binaries for Rust examples..."
cargo build --locked --bin iggy --examples
fi
# Verify server binary was built (needed by all examples)
echo "Verifying server binary:"
if [ -f "target/debug/iggy-server" ]; then
echo "✅ Server binary found at target/debug/iggy-server"
ls -lh target/debug/iggy-server
else
echo "❌ Server binary NOT found at target/debug/iggy-server"
echo "Checking target directory structure:"
find target -name "iggy-server" -type f 2>/dev/null || true
exit 1
fi
# For Rust examples, verify CLI was built
if [[ "${{ inputs.task }}" == "examples-rust" ]]; then
if [ -f "target/debug/iggy" ]; then
echo "✅ CLI binary found at target/debug/iggy"
ls -lh target/debug/iggy
else
echo "❌ CLI binary NOT found at target/debug/iggy"
exit 1
fi
fi
- name: Run Rust examples
if: inputs.component == 'examples-suite' && inputs.task == 'examples-rust'
run: |
echo "Running Rust examples tests..."
./scripts/run-rust-examples-from-readme.sh
- name: Run Go examples
if: inputs.component == 'examples-suite' && inputs.task == 'examples-go'
run: |
echo "Running Go examples tests..."
./scripts/run-go-examples-from-readme.sh
- name: Run Csharp examples
if: inputs.component == 'examples-suite' && inputs.task == 'examples-csharp'
run: |
echo "Running Csharp examples tests..."
./scripts/run-csharp-examples-from-readme.sh
- name: Run Python examples
if: inputs.component == 'examples-suite' && inputs.task == 'examples-python'
run: |
echo "Running Python examples tests..."
./scripts/run-python-examples-from-readme.sh
- name: Run Node.js examples
if: inputs.component == 'examples-suite' && inputs.task == 'examples-node'
run: |
echo "Running Node.js examples tests..."
# Build the local Node SDK first (examples use file: link to it)
cd foreign/node
npm ci
npm run build
cd ../..
# Install examples dependencies (will use the local SDK)
cd examples/node
npm ci
cd ../..
./scripts/run-node-examples-from-readme.sh
- name: Run Java examples
if: inputs.component == 'examples-suite' && inputs.task == 'examples-java'
run: |
echo "Running Java examples tests..."
./scripts/run-java-examples-from-readme.sh
- name: Upload reports
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.component }}-${{ inputs.task }}-reports-${{ github.run_id }}-${{ github.run_attempt }}
path: |
reports/**
target/llvm-cov/**
coverage.lcov
if-no-files-found: ignore
retention-days: 7