-
Notifications
You must be signed in to change notification settings - Fork 3
181 lines (159 loc) · 6.17 KB
/
Copy pathgo.yml
File metadata and controls
181 lines (159 loc) · 6.17 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
name: Go
on:
push:
branches: ['trunk']
pull_request:
branches: ['trunk']
workflow_dispatch:
jobs:
build:
name: Build and test ${{matrix.os}} go${{matrix.go-version}}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ['1.25', '1.26']
steps:
- uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}
- name: Vet
run: go vet -v ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: v2.12
- name: Build
run: go build -v ./...
# The Spice runtime cannot be installed or run natively on Windows, so the
# Windows job runs the runtime-free unit tests natively and defers the
# runtime install + integration tests to WSL (see the WSL steps below).
- name: Unit tests (Windows native)
if: matrix.os == 'windows-latest'
run: go test -v -run 'TestUserAgent|TestPrependedUserAgent|TestInferArrowType|TestAppendValueToBuilder|TestComprehensiveArrowTypes|TestParamType|TestTypedParamInference|TestExtendedArrowTypes|TestSearch' ./...
- name: Install Spice (https://install.spiceai.org) (Linux)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Retry helper for flaky network installs.
retry() {
local n
for n in 1 2 3; do
if "$@"; then return 0; fi
echo "::warning::attempt ${n}/3 failed: $*"
sleep 5
done
return 1
}
retry bash -c 'curl -sSL https://install.spiceai.org | /bin/bash'
echo "$HOME/.spice/bin" >> $GITHUB_PATH
retry "$HOME/.spice/bin/spice" install
- name: Init and start spice app (Unix)
if: matrix.os != 'windows-latest'
run: |
# Retry helper for flaky network installs.
retry() {
local n
for n in 1 2 3; do
if "$@"; then return 0; fi
echo "::warning::attempt ${n}/3 failed: $*"
sleep 5
done
return 1
}
spice init spice_qs
cd spice_qs
retry spice add spiceai/quickstart
spice run &> spice.log &
# Wait for Spice to be ready
echo "Waiting for Spice to be ready..."
for i in {1..60}; do
# -f fails on non-2xx; /v1/ready returns 200 only once datasets are
# loaded. (A substring `grep "ready"` also matches "not ready".)
if curl -fs http://localhost:8090/v1/ready >/dev/null 2>&1; then
echo "Spice is ready!"
break
fi
echo "Waiting... ($i/60)"
sleep 1
done
- name: Test
if: matrix.os != 'windows-latest'
env:
SPICE_API_KEY: ${{ secrets.SPICE_CLOUD_API_KEY }}
run: go test -v ./...
# Native Windows local runtime is unsupported ("Open WSL and run the Linux
# Spice CLI there instead"), so the integration tests run inside WSL against
# a Linux Spice runtime.
- name: Set up WSL (Windows)
if: matrix.os == 'windows-latest'
uses: Vampire/setup-wsl@v7
with:
# Ubuntu 24.04 (glibc 2.39) — the Spice binary requires glibc >= 2.38.
distribution: Ubuntu-24.04
additional-packages: curl ca-certificates git
# Forward the workspace path and API key into every wsl-bash step.
- name: Configure WSLENV (Windows)
if: matrix.os == 'windows-latest'
shell: bash
run: echo "WSLENV=GITHUB_WORKSPACE:SPICE_API_KEY" >> "$GITHUB_ENV"
- name: Install Spice and run integration tests in WSL (Windows)
if: matrix.os == 'windows-latest'
shell: wsl-bash {0}
env:
SPICE_API_KEY: ${{ secrets.SPICE_CLOUD_API_KEY }}
run: |
# Retry helper for flaky network installs.
retry() {
local n
for n in 1 2 3; do
if "$@"; then return 0; fi
echo "::warning::attempt ${n}/3 failed: $*"
sleep 5
done
return 1
}
# Install a current Go toolchain inside the WSL distribution.
GO_VER="$(curl -fsSL --retry 3 'https://go.dev/VERSION?m=text' | head -1)"
echo "Installing ${GO_VER} in WSL"
curl -fsSL --retry 3 "https://go.dev/dl/${GO_VER}.linux-amd64.tar.gz" -o /tmp/go.tgz
rm -rf /usr/local/go && tar -C /usr/local -xzf /tmp/go.tgz
export PATH="/usr/local/go/bin:${HOME}/.spice/bin:${PATH}"
go version
# Enter the checked-out repo (Windows workspace, mounted under /mnt).
cd "$(wslpath -u "${GITHUB_WORKSPACE}")"
# Install the Spice CLI and runtime (downloads can be flaky, so retry).
retry bash -c 'curl -sSL https://install.spiceai.org | /bin/bash'
retry spice install
# Start a quickstart runtime.
spice init spice_qs
cd spice_qs
retry spice add spiceai/quickstart
nohup spice run > spice.log 2>&1 &
cd ..
echo "Waiting for Spice to be ready..."
for i in $(seq 1 90); do
if curl -fs http://localhost:8090/v1/ready >/dev/null 2>&1; then
echo "Spice is ready!"
break
fi
echo "Waiting... ($i/90)"
sleep 2
done
go test -v ./...
- name: Print Spice logs (Unix)
if: always() && matrix.os != 'windows-latest'
run: |
echo "=== Spice Runtime Logs ==="
cat spice_qs/spice.log || echo "No log file found"
- name: Print Spice logs (WSL) (Windows)
if: always() && matrix.os == 'windows-latest'
shell: wsl-bash {0}
run: |
cd "$(wslpath -u "${GITHUB_WORKSPACE:-}" 2>/dev/null)" 2>/dev/null || true
echo "=== Spice Runtime Logs (WSL) ==="
cat spice_qs/spice.log 2>/dev/null || echo "No log file found"