manual build sqlite-wasm #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: manual build sqlite-wasm | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| sqlite_branch: | |
| description: "Optional branch to use for modules/sqlite" | |
| required: false | |
| default: "" | |
| emsdk_branch: | |
| description: "Optional branch to use for modules/emsdk" | |
| required: false | |
| default: "" | |
| sqlite_wasm_branch: | |
| description: "Optional branch to use for modules/sqlite-wasm" | |
| required: false | |
| default: "" | |
| sqlite_sync_branch: | |
| description: "Optional branch to use for modules/sqlite-sync" | |
| required: false | |
| default: "" | |
| sqlite_vector_branch: | |
| description: "Optional branch to use for modules/sqlite-vector" | |
| required: false | |
| default: "" | |
| permissions: | |
| id-token: write | |
| jobs: | |
| manual-build: | |
| runs-on: ubuntu-22.04 | |
| name: manual build sqlite-wasm | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| with: | |
| submodules: true | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: update npm # https://docs.npmjs.com/trusted-publishers | |
| run: npm install -g npm@latest | |
| - name: setup playwright for tests | |
| run: npx playwright install --with-deps && npx playwright install msedge && npx playwright install chrome | |
| - name: override submodule branches | |
| env: | |
| SQLITE_BRANCH: ${{ inputs.sqlite_branch }} | |
| EMSDK_BRANCH: ${{ inputs.emsdk_branch }} | |
| SQLITE_WASM_BRANCH: ${{ inputs.sqlite_wasm_branch }} | |
| SQLITE_SYNC_BRANCH: ${{ inputs.sqlite_sync_branch }} | |
| SQLITE_VECTOR_BRANCH: ${{ inputs.sqlite_vector_branch }} | |
| run: | | |
| set -euo pipefail | |
| checkout_branch() { | |
| local path="$1" | |
| local branch="$2" | |
| if [ -n "$branch" ]; then | |
| git -C "$path" fetch --depth 1 origin "$branch" | |
| git -C "$path" checkout --detach FETCH_HEAD | |
| fi | |
| } | |
| checkout_branch modules/sqlite "$SQLITE_BRANCH" | |
| checkout_branch modules/emsdk "$EMSDK_BRANCH" | |
| checkout_branch modules/sqlite-wasm "$SQLITE_WASM_BRANCH" | |
| checkout_branch modules/sqlite-sync "$SQLITE_SYNC_BRANCH" | |
| checkout_branch modules/sqlite-vector "$SQLITE_VECTOR_BRANCH" | |
| - name: build sqlite-wasm | |
| run: cd sqlite-wasm && npm run build && npm pack | |
| - name: resolve build artifact | |
| id: dist_artifact | |
| run: | | |
| set -euo pipefail | |
| tgz_path=$(ls sqlite-wasm/sqliteai-sqlite-wasm-*.tgz | head -n 1) | |
| if [ -z "$tgz_path" ]; then | |
| echo "No package tarball found under sqlite-wasm." | |
| exit 1 | |
| fi | |
| echo "path=$tgz_path" >> "$GITHUB_OUTPUT" | |
| echo "name=$(basename "$tgz_path" .tgz)" >> "$GITHUB_OUTPUT" | |
| - uses: actions/upload-artifact@v4.6.2 | |
| with: | |
| name: ${{ steps.dist_artifact.outputs.name }} | |
| path: ${{ steps.dist_artifact.outputs.path }} | |
| if-no-files-found: error |