diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 42a5891d..7833ea4f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,11 +33,6 @@ jobs: uses: nttld/setup-ndk@v1 with: ndk-version: r21e - - name: Setup Emscripten - if: startsWith(matrix.os, 'ubuntu') - uses: mymindstorm/setup-emsdk@v11 - with: - version: 2.0.23 # NB: Matches .NET 6 - name: Setup .NET uses: actions/setup-dotnet@v1 with: @@ -83,15 +78,6 @@ jobs: mkdir -p ../bin/e_sqlcipher/android cp -r libs/* ../bin/e_sqlcipher/android working-directory: cb/bld - - name: Build (Wasm) - if: startsWith(matrix.os, 'ubuntu') - run: | - #!/bin/bash - set -e - for f in wasm_*.sh; do - bash "$f" - done - working-directory: cb/bld - name: Build (macOS, iOS, tvOS) if: startsWith(matrix.os, 'macos') run: | @@ -113,6 +99,53 @@ jobs: name: bin-${{ matrix.os }} path: cb/bld/bin + build-wasm: + strategy: + matrix: + config: + # Don't forget to add a download-artifact step in publish + - '{ "tfm": "net6.0", "emsdk": "2.0.23" }' # eol: 2024-11-12 + - '{ "tfm": "net7.0", "emsdk": "3.1.12" }' # eol: 2023-05-08 + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + path: "cb" + - uses: actions/checkout@v2 + with: + repository: libtom/libtomcrypt + path: "libtomcrypt" + ref: "v1.18.2" + - name: Setup Emscripten + uses: mymindstorm/setup-emsdk@v11 + with: + version: ${{ fromJSON(matrix.config).emsdk }} + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.x + - name: Generate script + run: dotnet run + working-directory: cb/bld + - name: Update permissions + run: chmod +x *.sh + working-directory: cb/bld + - name: Clean output directory + run: rm -fr bin + working-directory: cb/bld + - name: Build (Wasm) + run: | + #!/bin/bash + set -e + for f in wasm_*.sh; do + bash "$f" ${{ fromJSON(matrix.config).tfm }} + done + working-directory: cb/bld + - uses: actions/upload-artifact@v2 + with: + name: bin-wasm-${{ fromJSON(matrix.config).tfm }} + path: cb/bld/bin + test: needs: build if: ${{ github.event_name == 'pull_request' }} @@ -181,7 +214,7 @@ jobs: dotnet run publish: - needs: build + needs: [ build, build-wasm ] if: ${{ github.event_name == 'push' }} runs-on: ubuntu-18.04 steps: @@ -205,6 +238,14 @@ jobs: with: name: bin-windows-2019 path: bld/bin + - uses: actions/download-artifact@v2 + with: + name: bin-wasm-net6.0 + path: cb/bld/bin + - uses: actions/download-artifact@v2 + with: + name: bin-wasm-net7.0 + path: cb/bld/bin - name: Fix permissions run: | find ./bld/bin/e_sqlite3 -name *.so | xargs chmod 0775 diff --git a/bld/bin/e_sqlcipher/wasm/e_sqlcipher.a b/bld/bin/e_sqlcipher/wasm/net6.0/e_sqlcipher.a similarity index 100% rename from bld/bin/e_sqlcipher/wasm/e_sqlcipher.a rename to bld/bin/e_sqlcipher/wasm/net6.0/e_sqlcipher.a diff --git a/bld/bin/e_sqlite3/wasm/e_sqlite3.a b/bld/bin/e_sqlite3/wasm/net6.0/e_sqlite3.a similarity index 100% rename from bld/bin/e_sqlite3/wasm/e_sqlite3.a rename to bld/bin/e_sqlite3/wasm/net6.0/e_sqlite3.a diff --git a/bld/cb.cs b/bld/cb.cs index 408a6955..95f6f744 100644 --- a/bld/cb.cs +++ b/bld/cb.cs @@ -411,8 +411,8 @@ static void write_wasm( tw.Write(" -o ./obj/{0}/{1}.o", subdir, b); tw.Write(" {0}\n", s); } - tw.Write("mkdir -p \"./bin/{0}\"\n", subdir); - tw.Write("emar rcs ./bin/{0}/wasm/{0}.a @wasm_{0}.libtoolfiles\n", libname); + tw.Write("mkdir -p \"./bin/{0}/$1\"\n", subdir); + tw.Write("emar rcs ./bin/{0}/$1/{1}.a @wasm_{1}.libtoolfiles\n", subdir, libname); } }