Skip to content

Refactor CI workflow: streamline environment variable setup and impro… #2

Refactor CI workflow: streamline environment variable setup and impro…

Refactor CI workflow: streamline environment variable setup and impro… #2

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
env:
GOFLAGS: -mod=mod
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.24.2'
- name: Set DUCKDB_HOME environment variable
run: echo "DUCKDB_HOME=${{ runner.temp }}/duckdb-home" >> $GITHUB_ENV
- name: Set GOMODCACHE environment variable
run: echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV
- name: Ensure DUCKDB_HOME exists
run: mkdir -p "${{ env.DUCKDB_HOME }}"
- name: Install system build deps
run: |
sudo apt-get update
sudo apt-get install -y build-essential pkg-config
- name: Run tests
run: |
# run all tests with verbose output
go test ./... -v
- name: Build and run examples
run: |
for pkg in $(go list ./... | grep '/example' || true); do
echo "Building $pkg"
go build -v "$pkg"
BIN=$(basename "$pkg")
# Try to run the binary if built successfully
if [ -f "$BIN" ]; then
echo "Running $BIN"
./"$BIN"
else
echo "Binary $BIN not found, skipping run."
fi
done