Skip to content

Commit 5d755af

Browse files
Refactor CI workflow: streamline environment variable setup and improve example package execution logic
Signed-off-by: Alex Lovell-Troy <[email protected]>
1 parent 727a047 commit 5d755af

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ jobs:
1010
test:
1111
runs-on: ubuntu-latest
1212
env:
13-
# Ensure DuckDB has a writable home inside the runner; tests may rely on this.
14-
DUCKDB_HOME: ${{ runner.temp }}/duckdb-home
1513
GOFLAGS: -mod=mod
1614
steps:
1715
- name: Checkout
@@ -20,17 +18,13 @@ jobs:
2018
- name: Set up Go
2119
uses: actions/setup-go@v4
2220
with:
23-
go-version: 1.24.2
21+
go-version: '1.24.2'
2422

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-
23+
- name: Set DUCKDB_HOME environment variable
24+
run: echo "DUCKDB_HOME=${{ runner.temp }}/duckdb-home" >> $GITHUB_ENV
25+
26+
- name: Set GOMODCACHE environment variable
27+
run: echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV
3428

3529
- name: Ensure DUCKDB_HOME exists
3630
run: mkdir -p "${{ env.DUCKDB_HOME }}"
@@ -47,10 +41,15 @@ jobs:
4741
4842
- name: Build and run examples
4943
run: |
50-
# Build any example packages under ./example
5144
for pkg in $(go list ./... | grep '/example' || true); do
5245
echo "Building $pkg"
5346
go build -v "$pkg"
54-
echo "Running $pkg"
55-
./"$pkg"
47+
BIN=$(basename "$pkg")
48+
# Try to run the binary if built successfully
49+
if [ -f "$BIN" ]; then
50+
echo "Running $BIN"
51+
./"$BIN"
52+
else
53+
echo "Binary $BIN not found, skipping run."
54+
fi
5655
done

0 commit comments

Comments
 (0)