Skip to content

Commit 8209fb6

Browse files
committed
Refactor GitHub Actions workflow and build script to streamline WABT installation and improve npm prepare step
1 parent 889b766 commit 8209fb6

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ jobs:
2323
- name: setup playwright for tests
2424
run: npx playwright install --with-deps && npx playwright install msedge && npx playwright install chrome
2525

26-
- name: install wabt
27-
run: sudo apt install wabt
28-
2926
- name: build, test and release sqlite-wasm
30-
run: cd sqlite-wasm && npm i && npm run deploy
27+
run: cd sqlite-wasm && npm run deploy
3128
env:
3229
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

build.sh

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
setup() {
2-
CPUS=1
3-
if [ "$OS" = "Windows_NT" ]; then
4-
CPUS=$(powershell -Command "[Environment]::ProcessorCount")
1+
CPUS=1
2+
if [ "$OS" = "Windows_NT" ]; then
3+
CPUS=$(powershell -Command "[Environment]::ProcessorCount")
4+
else
5+
if [ "$(uname -s | tr '[:upper:]' '[:lower:]')" = "darwin" ]; then
6+
CPUS=$(sysctl -n hw.ncpu)
7+
brew install wabt
58
else
6-
if [ "$(uname -s | tr '[:upper:]' '[:lower:]')" = "darwin" ]; then
7-
CPUS=$(sysctl -n hw.ncpu)
8-
brew install wabt >/dev/null 2>&1
9-
else
10-
CPUS=$(nproc)
11-
fi
9+
CPUS=$(nproc)
10+
sudo apt update && sudo apt install wabt
1211
fi
13-
echo "$CPUS"
14-
}
12+
fi
1513

1614
git clean -fdX
1715

@@ -29,7 +27,7 @@ do
2927
grep -F "$line" "$makefile" >/dev/null 2>&1 || echo "$line" >> "$makefile"
3028
done
3129

32-
(cd modules/sqlite/ext/wasm && make -j$(setup) dist sqlite3_wasm_extra_init.c=../../../../wasm.c)
30+
(cd modules/sqlite/ext/wasm && make -j$CPUS dist sqlite3_wasm_extra_init.c=../../../../wasm.c)
3331
unzip modules/sqlite/ext/wasm/sqlite-wasm-*.zip -d tmp
3432
mkdir -p sqlite-wasm/sqlite-wasm/jswasm
3533
mv tmp/sqlite-wasm-*/jswasm sqlite-wasm/sqlite-wasm/.

sqlite-wasm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"start": "npx http-server --coop",
5050
"test": "npm run start & HTTP_SERVER_PID=$! && sleep 3 && node test/test.cjs && kill $HTTP_SERVER_PID",
5151
"fix": "npx prettier . --write",
52-
"prepare": "npm run build && npm run fix && npm run publint && npm run check-types npm run test",
52+
"prepare": "npm run build && npm i && npm run fix && npm run publint && npm run check-types npm run test",
5353
"deploy": "npm run prepare && npm publish --access public --provenance"
5454
},
5555
"repository": {

0 commit comments

Comments
 (0)