From 19ae5cbcab02d999dd1e28e60e0528142f7bfd37 Mon Sep 17 00:00:00 2001 From: Avinash Sajjanshetty Date: Wed, 22 Oct 2025 14:07:19 +0530 Subject: [PATCH] update workflow to include libsql.h if changed --- .github/workflows/update-libsql.yml | 69 +++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update-libsql.yml b/.github/workflows/update-libsql.yml index 3c8fdb9..62f8c8c 100644 --- a/.github/workflows/update-libsql.yml +++ b/.github/workflows/update-libsql.yml @@ -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: @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 }}