Skip to content

Commit

Permalink
Add script to build Linux ARM binary in github action (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
pskrbasu authored Dec 20, 2023
1 parent fa1c38b commit 1a5a9db
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions scripts/build-linux-arm-sqlite.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/sh

set -e

list=(
"steampipe-plugin-$1"
)

if [[ ! ${MY_PATH} ]];
then
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
fi

echo $MY_PATH

mkdir $MY_PATH/go-cache || true
mkdir $MY_PATH/go-mod-cache || true

GOCACHE=$(docker run --memory="10g" --memory-swap="16g" --rm --name sp_sqlite_builder steampipe_qlite_builder:latest go env GOCACHE)
MODCACHE=$(docker run --memory="10g" --memory-swap="16g" --rm --name sp_sqlite_builder steampipe_qlite_builder:latest go env GOMODCACHE)

for item in "${list[@]}"; do
# Extract the plugin name (last word after the hyphen)
plugin_name=${item##*-}

echo "Processing plugin: ${plugin_name}"

# Step 1: Switch to steampipe-sqlite-extension directory
cd $GITHUB_WORKSPACE || exit 1

# Step 2: Run Docker commands for SQLite Builder
echo "Building SQLite extension for plugin: ${plugin_name}"
docker run --memory="10g" --memory-swap="16g" --rm --name sp_sqlite_builder -v "$(pwd)":/tmp/ext steampipe_qlite_builder make build plugin="${plugin_name}"

# Step 3: Tar the SQLite extension
tar -czvf steampipe_sqlite_${plugin_name}.linux_arm64.tar.gz steampipe_sqlite_${plugin_name}.so

# Final Check: If SQLite tar.gz file is created
if [ ! -f "steampipe_sqlite_${plugin_name}.linux_arm64.tar.gz" ]; then
echo "Error: Tar file for SQLite not created."
exit 1
fi

echo "Processing completed for plugin: ${plugin_name}"
done

echo "All plugins processed successfully."

0 comments on commit 1a5a9db

Please sign in to comment.