Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 65 additions & 4 deletions .github/workflows/update-libsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,33 @@ on:
default: 'libsql-0.9.4'

jobs:
extract-headers:
runs-on: ubuntu-latest
steps:
- name: Set libsql tag
run: |
TAG=${{ github.event.inputs.libsql_tag }}
echo "Using tag: $TAG"
echo "LIBSQL_TAG=$TAG" >> $GITHUB_ENV

- name: Checkout libsql at tag
uses: actions/checkout@v4
with:
repository: tursodatabase/libsql
ref: ${{ env.LIBSQL_TAG }}
path: libsql

- name: Extract headers
run: |
mkdir -p include
cp libsql/bindings/c/include/libsql.h include/

- name: Upload header artifact
uses: actions/upload-artifact@v4
with:
name: libsql-headers
path: include/

build-linux:
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -114,7 +141,7 @@ jobs:
path: go-libsql/lib/darwin_arm64

verify-linux-amd64:
needs: [build-linux]
needs: [build-linux, extract-headers]
runs-on: ubuntu-latest
steps:
- name: Checkout go-libsql
Expand All @@ -126,10 +153,18 @@ jobs:
name: libsql-linux_amd64
path: lib/linux_amd64

- name: Download headers
uses: actions/download-artifact@v4
with:
name: libsql-headers
path: lib/include

- name: Check binary details
run: |
echo "Linux AMD64 library size:"
ls -la lib/linux_amd64/libsql_experimental.a
echo "Header file:"
ls -la lib/include/libsql.h

- name: Set up Go
uses: actions/setup-go@v4
Expand All @@ -144,7 +179,7 @@ jobs:
echo "Linux AMD64 build successful!"

verify-linux-arm64:
needs: [build-linux]
needs: [build-linux, extract-headers]
runs-on: ubuntu-latest
steps:
- name: Checkout go-libsql
Expand All @@ -156,10 +191,18 @@ jobs:
name: libsql-linux_arm64
path: lib/linux_arm64

- name: Download headers
uses: actions/download-artifact@v4
with:
name: libsql-headers
path: lib/include

- name: Check binary details
run: |
echo "Linux ARM64 library size:"
ls -la lib/linux_arm64/libsql_experimental.a
echo "Header file:"
ls -la lib/include/libsql.h

- name: Set up Go
uses: actions/setup-go@v4
Expand All @@ -179,7 +222,7 @@ jobs:
echo "Linux ARM64 build successful!"

verify-darwin-arm64:
needs: [build-macos]
needs: [build-macos, extract-headers]
runs-on: macos-latest
steps:
- name: Checkout go-libsql
Expand All @@ -191,10 +234,18 @@ jobs:
name: libsql-darwin_arm64
path: lib/darwin_arm64

- name: Download headers
uses: actions/download-artifact@v4
with:
name: libsql-headers
path: lib/include

- name: Check binary details
run: |
echo "Darwin ARM64 library size:"
ls -la lib/darwin_arm64/libsql_experimental.a
echo "Header file:"
ls -la lib/include/libsql.h

- name: Set up Go
uses: actions/setup-go@v4
Expand Down Expand Up @@ -223,10 +274,19 @@ jobs:

- name: Copy artifacts to repository
run: |
mkdir -p lib/linux_amd64 lib/linux_arm64 lib/darwin_arm64
mkdir -p lib/linux_amd64 lib/linux_arm64 lib/darwin_arm64 lib/include
cp -r artifacts/libsql-linux_amd64/* lib/linux_amd64/
cp -r artifacts/libsql-linux_arm64/* lib/linux_arm64/
cp -r artifacts/libsql-darwin_arm64/* lib/darwin_arm64/

# only copy header if it changed
if ! cmp -s artifacts/libsql-headers/libsql.h lib/include/libsql.h 2>/dev/null; then
cp artifacts/libsql-headers/libsql.h lib/include/
echo "Header file updated"
else
echo "Header file unchanged, skipping"
fi

# Clean up artifacts directory to prevent it from being included in the PR
rm -rf artifacts

Expand All @@ -248,6 +308,7 @@ jobs:
- `linux_amd64/libsql_experimental.a`
- `linux_arm64/libsql_experimental.a`
- `darwin_arm64/libsql_experimental.a`
- `include/libsql.h` (if changed)

This update was generated automatically by the [update-libsql workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).
branch: update-${{ env.LIBSQL_TAG }}
Expand Down
Loading