DuckDB-Wasm extensions #54
This file contains 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: DuckDB-Wasm extensions | |
on: | |
workflow_dispatch: | |
inputs: | |
# Git ref of the duckdb repo | |
duckdb_tag: | |
type: string | |
# Git ref of the duckdb repo | |
platforms: | |
required: false | |
default: '["wasm_mvp", "wasm_eh"]' | |
type: string | |
# Publish extensions on extensions.duckdb.org? | |
release_s3: | |
required: true | |
type: boolean | |
default: false | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
jobs: | |
build_wasm: | |
name: Build extensions | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
duckdb_wasm_arch: ${{ fromJSON(github.event.inputs.platforms) }} | |
env: | |
VCPKG_TARGET_TRIPLET: "wasm32-emscripten" | |
GEN: Ninja | |
VCPKG_TOOLCHAIN_PATH: ${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake | |
DUCKDB_PLATFORM: "${{ matrix.duckdb_wasm_arch }}" | |
USE_MERGED_VCPKG_MANIFEST: 1 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- uses: mymindstorm/setup-emsdk@v13 | |
with: | |
version: 'latest' | |
- name: Install | |
shell: bash | |
run: sudo apt-get update -y -qq && sudo apt-get install -y -qq ninja-build | |
- name: Setup vcpkg | |
uses: lukka/[email protected] | |
with: | |
vcpkgGitCommitId: a1a1cbc975abf909a6c8985a6a2b8fe20bbd9bd6 | |
- name: Setup Ccache | |
uses: hendrikmuhs/ccache-action@main | |
with: | |
key: ${{ github.job }}-${{ matrix.duckdb_wasm_arch }} | |
- name: PatchDuckDB | |
run: | | |
cd duckdb | |
git tag v0.10.3 | |
#git apply ../cmake.patch | |
cp ../extension_config_local.cmake extension/extension_config.cmake | |
- name: Build Wasm module MVP | |
if: ${{ matrix.duckdb_wasm_arch == 'wasm_mvp' }} | |
run: | | |
cd duckdb && DUCKDB_PLATFORM=wasm_mvp make wasm_mvp | |
- name: Build Wasm module EH | |
if: ${{ matrix.duckdb_wasm_arch == 'wasm_eh' }} | |
run: | | |
cd duckdb && DUCKDB_PLATFORM=wasm_eh make wasm_eh | |
- name: Build Wasm module THREADS | |
if: ${{ matrix.duckdb_wasm_arch == 'wasm_threads' }} | |
run: | | |
cd duckdb && DUCKDB_PLATFORM=wasm_threads make wasm_threads CMAKE_C_FLAGS="-pthread" | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: duckdb_extensions_${{ env.DUCKDB_PLATFORM }} | |
path: duckdb/build/${{ matrix.duckdb_wasm_arch }}/repository/${{ inputs.duckdb_tag }}/${{ env.DUCKDB_PLATFORM }} | |
retention-days: 1 | |
publish: | |
name: Publish extensions | |
runs-on: ubuntu-latest | |
needs: | |
- build_wasm | |
strategy: | |
matrix: | |
duckdb_arch: ${{ fromJSON(github.event.inputs.platforms) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: duckdb_extensions_${{ matrix.duckdb_arch }} | |
path: build/to_be_deployed/${{ inputs.duckdb_tag }}/${{ matrix.duckdb_arch }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install aws | |
run: | | |
pip install awscli | |
- name: Sign and deploy Wasm extensions (no credentials) | |
if: ${{ ! inputs.release_s3 }} | |
run: | | |
bash ./extension-upload-wasm.sh ${{ matrix.duckdb_arch }} ${{ inputs.duckdb_tag }} | |
- name: Sign and deploy Wasm extensions (with credentials) | |
if: ${{ inputs.release_s3 }} | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.S3_DUCKDB_ORG_DEPLOY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_DUCKDB_ORG_DEPLOY_KEY }} | |
AWS_DEFAULT_REGION: ${{ secrets.S3_DUCKDB_ORG_REGION }} | |
BUCKET_NAME: ${{ secrets.S3_DUCKDB_ORG_BUCKET }} | |
DUCKDB_EXTENSION_SIGNING_PK: ${{ secrets.S3_DUCKDB_ORG_EXTENSION_SIGNING_PK }} | |
run: | | |
bash ./extension-upload-wasm.sh ${{ matrix.duckdb_arch }} ${{ inputs.duckdb_tag }} |