Skip to content

fix(adbc): re-authenticate on Unauthenticated instead of failing permanently #256

fix(adbc): re-authenticate on Unauthenticated instead of failing permanently

fix(adbc): re-authenticate on Unauthenticated instead of failing permanently #256

Workflow file for this run

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' ./...
- name: Install Spice (https://install.spiceai.org) (Linux)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl https://install.spiceai.org | /bin/bash
echo "$HOME/.spice/bin" >> $GITHUB_PATH
$HOME/.spice/bin/spice install
- name: Init and start spice app (Unix)
if: matrix.os != 'windows-latest'
run: |
spice init spice_qs
cd spice_qs
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
if curl -s http://localhost:8090/v1/ready 2>/dev/null | grep -q "ready"; 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"