forked from mandel59/sqlite-wasm
-
Notifications
You must be signed in to change notification settings - Fork 4
163 lines (132 loc) · 4.77 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
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@v3
- 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: ubuntu-latest
container: 'unoplatform/wasm-build:2.0'
steps:
- uses: actions/checkout@v3
- 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: Build nuget
run: |
mono $GITHUB_WORKSPACE/src/nuget/nuget.exe pack src/nuget/uno.sqlite-wasm.nuspec -OutputDirectory "$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@v3
- 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 }}