|
| 1 | +name: Build and upload SQLite3 WASM |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "*" |
| 7 | + |
| 8 | +jobs: |
| 9 | + compile_sqlite3_wasm: |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + os: [macos-latest] |
| 13 | + |
| 14 | + name: Compile sqlite3 wasm for ${{ matrix.os }} |
| 15 | + runs-on: ${{ matrix.os }} |
| 16 | + |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v3 |
| 19 | + with: |
| 20 | + submodules: recursive |
| 21 | + - name: Setup Homebrew |
| 22 | + id: set-up-homebrew |
| 23 | + uses: Homebrew/actions/setup-homebrew@master |
| 24 | + - name: Install Flutter |
| 25 | + uses: subosito/flutter-action@v2 |
| 26 | + with: |
| 27 | + flutter-version: "3.x" |
| 28 | + channel: "stable" |
| 29 | + - name: Setup macOS |
| 30 | + if: runner.os == 'macOS' |
| 31 | + run: | |
| 32 | + brew install cmake |
| 33 | + brew install llvm |
| 34 | + brew install binaryen |
| 35 | + curl -sL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/libclang_rt.builtins-wasm32-wasi-22.0.tar.gz | \ |
| 36 | + tar x -zf - -C /opt/homebrew/opt/llvm/lib/clang/18* |
| 37 | + curl -sS -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sysroot-22.0.tar.gz | \ |
| 38 | + sudo tar x -zf - -C /opt |
| 39 | + - name: Install Rust Nightly |
| 40 | + uses: dtolnay/rust-toolchain@stable |
| 41 | + with: |
| 42 | + toolchain: nightly-2024-05-18 |
| 43 | + components: rust-src |
| 44 | + - name: Set environment variable |
| 45 | + run: | |
| 46 | + echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH |
| 47 | + - name: Flutter pub get |
| 48 | + working-directory: sqlite3 |
| 49 | + run: | |
| 50 | + flutter pub get |
| 51 | + - name: Compile sqlite3.wasm on macOS |
| 52 | + if: runner.os == 'macOS' |
| 53 | + working-directory: sqlite3 |
| 54 | + run: | |
| 55 | + cmake -Dwasi_sysroot=/opt/wasi-sysroot -Dclang=/opt/homebrew/opt/llvm/bin/clang -S assets/wasm -B .dart_tool/sqlite3_build --toolchain toolchain.cmake |
| 56 | + cmake --build .dart_tool/sqlite3_build/ -t output -j |
| 57 | + - name: Upload sqlite3 binary |
| 58 | + uses: actions/upload-artifact@v4 |
| 59 | + with: |
| 60 | + name: sqlite3.wasm |
| 61 | + path: sqlite3/.dart_tool/sqlite3_build/sqlite3.wasm |
| 62 | + - name: Upload sqlite3 debug binary |
| 63 | + uses: actions/upload-artifact@v4 |
| 64 | + with: |
| 65 | + name: sqlite3.debug.wasm |
| 66 | + path: sqlite3/.dart_tool/sqlite3_build/sqlite3.debug.wasm |
| 67 | + - name: Upload sqlite3 binary |
| 68 | + uses: svenstaro/upload-release-action@v2 |
| 69 | + with: |
| 70 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + overwrite: true |
| 72 | + file: sqlite3/.dart_tool/sqlite3_build/sqlite3.wasm |
| 73 | + asset_name: sqlite3.wasm |
| 74 | + body: "SQLite3 WASM binary" |
| 75 | + tag: ${{ github.ref_name }} |
| 76 | + - name: Upload sqlite3 debug binary |
| 77 | + uses: svenstaro/upload-release-action@v2 |
| 78 | + with: |
| 79 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 80 | + overwrite: true |
| 81 | + file: sqlite3/.dart_tool/sqlite3_build/sqlite3.debug.wasm |
| 82 | + asset_name: sqlite3.debug.wasm |
| 83 | + tag: ${{ github.ref_name }} |
0 commit comments