Repository navigation
204 lines (175 loc) · 6.75 KB
/
Copy path_test_examples.yml
File metadata and controls
204 lines (175 loc) · 6.75 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# 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:
matrix:
type: string
required: true
description: "Selected component/task entries"
permissions:
contents: read
security-events: write
jobs:
run:
name: ${{ matrix.name || matrix.task }}
strategy:
fail-fast: true
matrix: ${{ fromJSON(inputs.matrix) }}
runs-on: ubuntu-26.04
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v7.0.1
- name: Setup Rust for examples
if: contains(fromJSON('["examples-rust","examples-python","examples-php"]'), matrix.task)
uses: ./.github/actions/utils/setup-rust
with:
free-disk-space: ${{ matrix.task != 'examples-python' }}
- name: Setup Node for examples
if: matrix.task == 'examples-node'
uses: ./.github/actions/utils/setup-node
with:
node-version: "24"
workspace: examples/node
- name: Install PHP build dependencies
if: matrix.task == 'examples-php'
shell: bash
run: |
./scripts/ci/apt-install.sh --no-install-recommends \
clang \
libclang-dev \
libhwloc-dev \
libssl-dev \
php8.5-cli \
php8.5-dev \
pkg-config
php_bin="$(command -v php8.5)"
php_config="$(command -v php-config8.5)"
# bindgen loads the newest libclang on the runner but reads builtin
# headers from the default clang, and the two differ on Ubuntu 26.04.
llvm_dir="$(dirname "$(dirname "$(readlink -f "$(command -v clang)")")")"
{
echo "PHP=${php_bin}"
echo "PHP_CONFIG=${php_config}"
echo "LIBCLANG_PATH=${llvm_dir}/lib"
} >> "$GITHUB_ENV"
"${php_bin}" --version
"${php_config}" --version
- name: Setup Java for examples
if: matrix.task == 'examples-java'
uses: ./.github/actions/utils/setup-java
with:
gradle-cache-disabled: "true"
- name: Setup Go for examples
if: matrix.task == 'examples-go'
uses: ./.github/actions/utils/setup-go
with:
download-deps: "false"
- name: Setup Swift for examples
if: matrix.task == 'examples-swift'
uses: ./.github/actions/utils/setup-swift
with:
cache-key: "examples"
package-path: "examples/swift/getting-started"
# Built before the server starts, so each example run only executes.
- name: Build Swift examples
if: matrix.task == 'examples-swift'
run: swift build --package-path examples/swift/getting-started -Xswiftc -warnings-as-errors
- name: Test Go examples
if: matrix.task == 'examples-go'
working-directory: examples/go
run: go test -race ./...
- name: Test Java examples
if: matrix.task == 'examples-java'
working-directory: examples/java
run: ./gradlew test
- name: Build Rust examples
if: matrix.task == 'examples-rust'
run: cargo build --locked --examples
- name: Download runtime binaries
uses: ./.github/actions/utils/download-runtime
- name: Setup Python
if: matrix.task == 'examples-python'
uses: actions/setup-python@v7.0.0
with:
python-version: "3.11"
- name: Setup uv
if: matrix.task == 'examples-python'
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
- name: Cache uv
if: matrix.task == 'examples-python'
uses: actions/cache@v6.1.0
with:
path: ~/.cache/uv
key: uv-${{ runner.os }}-${{ hashFiles('examples/python/uv.lock', 'foreign/python/uv.lock', 'bdd/python/uv.lock') }}
- name: Build PHP extension for examples
if: matrix.task == 'examples-php'
shell: bash
run: |
export CARGO_TARGET_DIR="${GITHUB_WORKSPACE}/target"
cargo build --manifest-path foreign/php/Cargo.toml
extension="$(find target/debug -maxdepth 1 -name 'libiggy_php.so' -print -quit)"
if [ -z "$extension" ]; then
echo "PHP extension was not produced"
exit 1
fi
echo "PHP_IGGY_EXTENSION=$(realpath "$extension")" >> "$GITHUB_ENV"
ls -lh "$extension"
- name: Build Node SDK for examples
if: matrix.task == 'examples-node'
run: |
cd foreign/node
npm ci
npm run build
cd ../..
cd examples/node
npm ci
cd ../..
- name: Run Rust examples
if: matrix.task == 'examples-rust'
run: ./scripts/run-examples-from-readme.sh --language rust
- name: Run Go examples
if: matrix.task == 'examples-go'
run: ./scripts/run-examples-from-readme.sh --language go
- name: Run C# examples
if: matrix.task == 'examples-csharp'
run: ./scripts/run-examples-from-readme.sh --language csharp
- name: Run Python examples
if: matrix.task == 'examples-python'
run: ./scripts/run-examples-from-readme.sh --language python
- name: Run PHP examples
if: matrix.task == 'examples-php'
run: ./scripts/run-examples-from-readme.sh --language php
- name: Run Node.js examples
if: matrix.task == 'examples-node'
run: ./scripts/run-examples-from-readme.sh --language node
- name: Run Java examples
if: matrix.task == 'examples-java'
run: ./scripts/run-examples-from-readme.sh --language java
- name: Run Swift examples
if: matrix.task == 'examples-swift'
run: ./scripts/run-examples-from-readme.sh --language swift
- name: Upload reports
if: always()
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.component }}-${{ matrix.task }}-reports-${{ github.run_id }}-${{ github.run_attempt }}
path: reports/**
if-no-files-found: ignore
retention-days: 7