Skip to content

Commit 727a047

Browse files
Add CI step to build and run examples
Signed-off-by: Alex Lovell-Troy <[email protected]>
1 parent ebbbce2 commit 727a047

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/ci.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
env:
13+
# Ensure DuckDB has a writable home inside the runner; tests may rely on this.
14+
DUCKDB_HOME: ${{ runner.temp }}/duckdb-home
15+
GOFLAGS: -mod=mod
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v4
22+
with:
23+
go-version: 1.24.2
24+
25+
- name: Cache Go modules
26+
uses: actions/cache@v4
27+
with:
28+
path: |
29+
~/.cache/go-build
30+
${{ env.GOMODCACHE }}
31+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
32+
restore-keys: |
33+
${{ runner.os }}-go-
34+
35+
- name: Ensure DUCKDB_HOME exists
36+
run: mkdir -p "${{ env.DUCKDB_HOME }}"
37+
38+
- name: Install system build deps
39+
run: |
40+
sudo apt-get update
41+
sudo apt-get install -y build-essential pkg-config
42+
43+
- name: Run tests
44+
run: |
45+
# run all tests with verbose output
46+
go test ./... -v
47+
48+
- name: Build and run examples
49+
run: |
50+
# Build any example packages under ./example
51+
for pkg in $(go list ./... | grep '/example' || true); do
52+
echo "Building $pkg"
53+
go build -v "$pkg"
54+
echo "Running $pkg"
55+
./"$pkg"
56+
done

0 commit comments

Comments
 (0)