Skip to content

Commit 1a5a9db

Browse files
authored
Add script to build Linux ARM binary in github action (#75)
1 parent fa1c38b commit 1a5a9db

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

scripts/build-linux-arm-sqlite.sh

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
list=(
6+
"steampipe-plugin-$1"
7+
)
8+
9+
if [[ ! ${MY_PATH} ]];
10+
then
11+
MY_PATH="`dirname \"$0\"`" # relative
12+
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
13+
fi
14+
15+
echo $MY_PATH
16+
17+
mkdir $MY_PATH/go-cache || true
18+
mkdir $MY_PATH/go-mod-cache || true
19+
20+
GOCACHE=$(docker run --memory="10g" --memory-swap="16g" --rm --name sp_sqlite_builder steampipe_qlite_builder:latest go env GOCACHE)
21+
MODCACHE=$(docker run --memory="10g" --memory-swap="16g" --rm --name sp_sqlite_builder steampipe_qlite_builder:latest go env GOMODCACHE)
22+
23+
for item in "${list[@]}"; do
24+
# Extract the plugin name (last word after the hyphen)
25+
plugin_name=${item##*-}
26+
27+
echo "Processing plugin: ${plugin_name}"
28+
29+
# Step 1: Switch to steampipe-sqlite-extension directory
30+
cd $GITHUB_WORKSPACE || exit 1
31+
32+
# Step 2: Run Docker commands for SQLite Builder
33+
echo "Building SQLite extension for plugin: ${plugin_name}"
34+
docker run --memory="10g" --memory-swap="16g" --rm --name sp_sqlite_builder -v "$(pwd)":/tmp/ext steampipe_qlite_builder make build plugin="${plugin_name}"
35+
36+
# Step 3: Tar the SQLite extension
37+
tar -czvf steampipe_sqlite_${plugin_name}.linux_arm64.tar.gz steampipe_sqlite_${plugin_name}.so
38+
39+
# Final Check: If SQLite tar.gz file is created
40+
if [ ! -f "steampipe_sqlite_${plugin_name}.linux_arm64.tar.gz" ]; then
41+
echo "Error: Tar file for SQLite not created."
42+
exit 1
43+
fi
44+
45+
echo "Processing completed for plugin: ${plugin_name}"
46+
done
47+
48+
echo "All plugins processed successfully."

0 commit comments

Comments
 (0)