Skip to content

Commit

Permalink
Add a Wasm build for .NET 7
Browse files Browse the repository at this point in the history
  • Loading branch information
bricelam committed Sep 8, 2022
1 parent fd1d3eb commit df6789c
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 18 deletions.
81 changes: 65 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: |
Expand All @@ -113,8 +99,55 @@ jobs:
name: bin-${{ matrix.os }}
path: cb/bld/bin

build-wasm:
strategy:
matrix:
config:
# Don't forget to add a download-artifact steps in test and 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
needs: [ build, build-wasm]
if: ${{ github.event_name == 'pull_request' }}
strategy:
matrix:
Expand Down Expand Up @@ -150,6 +183,14 @@ jobs:
with:
name: bin-windows-2019
path: cb/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
# note that the following is mostly a copy of the build script from the SQLitePCL.raw repo
- name: "Set up Java: 11"
uses: actions/setup-java@v1
Expand Down Expand Up @@ -181,7 +222,7 @@ jobs:
dotnet run
publish:
needs: build
needs: [ build, build-wasm ]
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-18.04
steps:
Expand All @@ -205,6 +246,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
Expand Down
4 changes: 2 additions & 2 deletions bld/cb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit df6789c

Please sign in to comment.