-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to build Linux ARM binary in github action (#75)
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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." |