Skip to content

fix: generate .a from .o for older emscripten #73

fix: generate .a from .o for older emscripten

fix: generate .a from .o for older emscripten #73

Workflow file for this run

name: CI
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
EMSCRIPTEN_VERSION: ['1.39.11','1.40.0','2.0.5','2.0.6','2.0.9','2.0.11','2.0.12','2.0.23','2.0.26','3.1.12','3.1.34','3.1.56']
EMSCRIPTEN_THREADS: ['true', '']
EMSCRIPTEN_SIMD: ['true', '']
env:
ARTIFACTS_PATH: './artifacts'
name: 'Build (emsdk:${{ matrix.EMSCRIPTEN_VERSION }} Threads:${{ matrix.EMSCRIPTEN_THREADS }} SIMD:${{ matrix.EMSCRIPTEN_SIMD }})'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Set Variable from current Commit
run: |
set -e
echo "EMSCRIPTEN_VERSION=${{ matrix.EMSCRIPTEN_VERSION }}" >> $GITHUB_ENV
echo "EMSCRIPTEN_THREADS=${{ matrix.EMSCRIPTEN_THREADS }}" >> $GITHUB_ENV
echo "EMSCRIPTEN_SIMD=${{ matrix.EMSCRIPTEN_SIMD }}" >> $GITHUB_ENV
- name: 'Setup Emscripten'
shell: bash
run: |
set -e
cd ~
git clone --branch $EMSCRIPTEN_VERSION https://github.com/emscripten-core/emsdk
cd emsdk
./emsdk install $EMSCRIPTEN_VERSION
./emsdk activate $EMSCRIPTEN_VERSION
- name: 'Build SQLite'
shell: bash
run: |
set -xe
MAJOR_VERSION="$(printf '%s' "$EMSCRIPTEN_VERSION" | cut -c1)"
if [ "$EMSCRIPTEN_THREADS" = "true" ]; then
FEATURES_CONFIGURATION="/mt";
else
FEATURES_CONFIGURATION="/st";
fi
if [ "$EMSCRIPTEN_SIMD" = 'true' ]; then
FEATURES_CONFIGURATION="$FEATURES_CONFIGURATION,simd";
fi
if [ $MAJOR_VERSION -lt 3 ]; then
if [ "$FEATURES_CONFIGURATION" != "/st" ]; then
echo "Skipping build for incompatible features"
exit 0;
fi
# Preserve the boostrapper 3.3 and below format
unset FEATURES_CONFIGURATION
fi
source ~/emsdk/emsdk_env.sh
mkdir -p $ARTIFACTS_PATH
make
# Use the multi-version convention https://github.com/unoplatform/uno.wasm.bootstrap#static-linking-multi-version-support
SQLITE3_DIST_PATH=$ARTIFACTS_PATH/native/sqlite3.a/$EMSCRIPTEN_VERSION$FEATURES_CONFIGURATION
mkdir -p $SQLITE3_DIST_PATH
cp dist/sqlite3.a $SQLITE3_DIST_PATH
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: sqlite-binaries-${{ matrix.EMSCRIPTEN_VERSION }}-${{ matrix.EMSCRIPTEN_THREADS }}-${{ matrix.EMSCRIPTEN_SIMD }}
path: ./artifacts
package:
needs: build
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: sqlite-binaries-merged
pattern: sqlite-binaries-*
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: sqlite-binaries-merged
path: ./native-artifacts
- name: Setup .NET SDK
uses: actions/setup-dotnet@v1.7.2
with:
dotnet-version: 8.0.100
- name: List files
run: |
Get-ChildItem -Recurse ./native-artifacts
- name: Build nuget
run: |
cd src\nuget
& .\nuget.exe pack uno.sqlite-wasm.nuspec -OutputDirectory "$env:GITHUB_WORKSPACE\artifacts"
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: nuget
path: ./artifacts
##
## Release Job
##
release_job:
if: github.event_name == 'push'
needs: [package]
runs-on: ubuntu-latest
environment:
name: Release
steps:
- uses: actions/checkout@v4
- name: Download package
uses: actions/download-artifact@v4
with:
name: nuget
path: artifacts
- name: Setup .NET SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.100
- name: Setup SignClient
run: |
dotnet tool install --tool-path build SignClient
- name: SignClient
shell: pwsh
run: |
build/SignClient sign -i artifacts/*.nupkg -c build/SignClient.json -r "${{ secrets.UNO_PLATFORM_CODESIGN_USERNAME }}" -s "${{ secrets.UNO_PLATFORM_CODESIGN_SECRET }}" -n "sqlite-wasm" -d "sqlite-wasm" -u "https://github.dev/unoplatform/Uno.sqlite-wasm"
- name: NuGet Push
shell: pwsh
run: |
dotnet nuget push artifacts/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_ORG_API_KEY }}