Skip to content

ci: fix build #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 28 additions & 8 deletions servlets/amadeus-flight-api/prepare.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
#!/bin/bash
set -eou pipefail

# Function to check if a command exists
command_exists () {
command -v "$1" >/dev/null 2>&1
}

# Function to compare version numbers
version_gt() {
test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"
}

missing_deps=0

# Check for Go
if ! (command_exists go); then
missing_deps=1
echo "❌ Go (supported version between 1.18 - 1.22) is not installed."
echo "❌ Go (supported version between 1.20 - 1.24) is not installed."
echo ""
echo "To install Go, visit the official download page:"
echo "👉 https://go.dev/dl/"
Expand All @@ -26,27 +32,29 @@ if ! (command_exists go); then
echo "🔹 Arch Linux:"
echo " sudo pacman -S go"
echo ""
echo "🔹 Windows:"
echo " scoop install go"
echo ""
fi

# Check for the right version of Go, needed by TinyGo (supports go 1.18 - 1.22)
# Check for the right version of Go, needed by TinyGo (supports go 1.20 - 1.24)
if (command_exists go); then
compat=0
for v in `seq 18 22`; do
for v in `seq 20 24`; do
if (go version | grep -q "go1.$v"); then
compat=1
fi
done

if [ $compat -eq 0 ]; then
echo "❌ Supported Go version is not installed. Must be Go 1.18 - 1.22."
echo "❌ Supported Go version is not installed. Must be Go 1.20 - 1.24."
echo ""
fi
fi


ARCH=$(arch)

# Check for TinyGo
# Check for TinyGo and its version
if ! (command_exists tinygo); then
missing_deps=1
echo "❌ TinyGo is not installed."
Expand All @@ -61,12 +69,24 @@ if ! (command_exists tinygo); then
echo " brew install tinygo"
echo ""
echo "🔹 Ubuntu/Debian:"
echo " wget https://github.com/tinygo-org/tinygo/releases/download/v0.31.2/tinygo_0.31.2_$ARCH.deb"
echo " sudo dpkg -i tinygo_0.31.2_$ARCH.deb"
echo " wget https://github.com/tinygo-org/tinygo/releases/download/v0.34.0/tinygo_0.34.0_$ARCH.deb"
echo " sudo dpkg -i tinygo_0.34.0_$ARCH.deb"
echo ""
echo "🔹 Arch Linux:"
echo " pacman -S extra/tinygo"
echo ""
echo "🔹 Windows:"
echo " scoop install tinygo"
echo ""
else
# Check TinyGo version
tinygo_version=$(tinygo version | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' | head -n1)
if ! version_gt "$tinygo_version" "0.33.0"; then
missing_deps=1
echo "❌ TinyGo version must be >= 0.34.0 (current version: $tinygo_version)"
echo "Please update TinyGo to a newer version."
echo ""
fi
fi

go install golang.org/x/tools/cmd/goimports@latest
12 changes: 6 additions & 6 deletions servlets/assembly-ai/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ missing_deps=0
# Check for Go
if ! (command_exists go); then
missing_deps=1
echo "❌ Go (supported version between 1.18 - 1.23) is not installed."
echo "❌ Go (supported version between 1.20 - 1.24) is not installed."
echo ""
echo "To install Go, visit the official download page:"
echo "👉 https://go.dev/dl/"
Expand All @@ -37,17 +37,17 @@ if ! (command_exists go); then
echo ""
fi

# Check for the right version of Go, needed by TinyGo (supports go 1.18 - 1.23)
# Check for the right version of Go, needed by TinyGo (supports go 1.20 - 1.24)
if (command_exists go); then
compat=0
for v in `seq 18 23`; do
for v in `seq 20 24`; do
if (go version | grep -q "go1.$v"); then
compat=1
fi
done

if [ $compat -eq 0 ]; then
echo "❌ Supported Go version is not installed. Must be Go 1.18 - 1.23."
echo "❌ Supported Go version is not installed. Must be Go 1.20 - 1.24."
echo ""
fi
fi
Expand Down Expand Up @@ -81,9 +81,9 @@ if ! (command_exists tinygo); then
else
# Check TinyGo version
tinygo_version=$(tinygo version | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' | head -n1)
if ! version_gt "$tinygo_version" "0.34.0"; then
if ! version_gt "$tinygo_version" "0.33.0"; then
missing_deps=1
echo "❌ TinyGo version must be greater than 0.34.0 (current version: $tinygo_version)"
echo "❌ TinyGo version must be >= 0.34.0 (current version: $tinygo_version)"
echo "Please update TinyGo to a newer version."
echo ""
fi
Expand Down
8 changes: 4 additions & 4 deletions servlets/bluesky/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ missing_deps=0
# Check for Go
if ! (command_exists go); then
missing_deps=1
echo "❌ Go (supported version between 1.18 - 1.22) is not installed."
echo "❌ Go (supported version between 1.19 - 1.23) is not installed."
echo ""
echo "To install Go, visit the official download page:"
echo "👉 https://go.dev/dl/"
Expand All @@ -28,17 +28,17 @@ if ! (command_exists go); then
echo ""
fi

# Check for the right version of Go, needed by TinyGo (supports go 1.18 - 1.22)
# Check for the right version of Go, needed by TinyGo (supports go 1.19 - 1.23)
if (command_exists go); then
compat=0
for v in `seq 18 22`; do
for v in `seq 19 23`; do
if (go version | grep -q "go1.$v"); then
compat=1
fi
done

if [ $compat -eq 0 ]; then
echo "❌ Supported Go version is not installed. Must be Go 1.18 - 1.22."
echo "❌ Supported Go version is not installed. Must be Go 1.19 - 1.23."
echo ""
fi
fi
Expand Down
8 changes: 4 additions & 4 deletions servlets/brave-search/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ missing_deps=0
# Check for Go
if ! (command_exists go); then
missing_deps=1
echo "❌ Go (supported version between 1.18 - 1.22) is not installed."
echo "❌ Go (supported version between 1.19 - 1.23) is not installed."
echo ""
echo "To install Go, visit the official download page:"
echo "👉 https://go.dev/dl/"
Expand All @@ -28,17 +28,17 @@ if ! (command_exists go); then
echo ""
fi

# Check for the right version of Go, needed by TinyGo (supports go 1.18 - 1.22)
# Check for the right version of Go, needed by TinyGo (supports go 1.19 - 1.23)
if (command_exists go); then
compat=0
for v in `seq 18 22`; do
for v in `seq 19 23`; do
if (go version | grep -q "go1.$v"); then
compat=1
fi
done

if [ $compat -eq 0 ]; then
echo "❌ Supported Go version is not installed. Must be Go 1.18 - 1.22."
echo "❌ Supported Go version is not installed. Must be Go 1.19 - 1.23."
echo ""
fi
fi
Expand Down
8 changes: 4 additions & 4 deletions servlets/github/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ missing_deps=0
# Check for Go
if ! (command_exists go); then
missing_deps=1
echo "❌ Go (supported version between 1.18 - 1.22) is not installed."
echo "❌ Go (supported version between 1.19 - 1.23) is not installed."
echo ""
echo "To install Go, visit the official download page:"
echo "👉 https://go.dev/dl/"
Expand All @@ -28,17 +28,17 @@ if ! (command_exists go); then
echo ""
fi

# Check for the right version of Go, needed by TinyGo (supports go 1.18 - 1.22)
# Check for the right version of Go, needed by TinyGo (supports go 1.19 - 1.23)
if (command_exists go); then
compat=0
for v in `seq 18 22`; do
for v in `seq 19 23`; do
if (go version | grep -q "go1.$v"); then
compat=1
fi
done

if [ $compat -eq 0 ]; then
echo "❌ Supported Go version is not installed. Must be Go 1.18 - 1.22."
echo "❌ Supported Go version is not installed. Must be Go 1.19 - 1.23."
echo ""
fi
fi
Expand Down
8 changes: 4 additions & 4 deletions servlets/google-maps-image/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ missing_deps=0
# Check for Go
if ! (command_exists go); then
missing_deps=1
echo "❌ Go (supported version between 1.18 - 1.22) is not installed."
echo "❌ Go (supported version between 1.19 - 1.23) is not installed."
echo ""
echo "To install Go, visit the official download page:"
echo "👉 https://go.dev/dl/"
Expand All @@ -28,17 +28,17 @@ if ! (command_exists go); then
echo ""
fi

# Check for the right version of Go, needed by TinyGo (supports go 1.18 - 1.22)
# Check for the right version of Go, needed by TinyGo (supports go 1.19 - 1.23)
if (command_exists go); then
compat=0
for v in `seq 18 22`; do
for v in `seq 19 23`; do
if (go version | grep -q "go1.$v"); then
compat=1
fi
done

if [ $compat -eq 0 ]; then
echo "❌ Supported Go version is not installed. Must be Go 1.18 - 1.22."
echo "❌ Supported Go version is not installed. Must be Go 1.19 - 1.23."
echo ""
fi
fi
Expand Down
19 changes: 19 additions & 0 deletions servlets/sqlite/install-wasi-sdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Orignal from: https://github.com/Shopify/javy

set -euo pipefail

PATH_TO_SDK="./wasi-sdk"
if [[ ! -d $PATH_TO_SDK ]]; then
TMPGZ=$(mktemp)
VERSION_MAJOR="24"
VERSION_MINOR="0"
ARCH=$(uname -m)
if [[ "$(uname -s)" == "Darwin" ]]; then
curl --fail --location --silent https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${VERSION_MAJOR}/wasi-sdk-${VERSION_MAJOR}.${VERSION_MINOR}-${ARCH}-macos.tar.gz --output $TMPGZ
else
curl --fail --location --silent https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${VERSION_MAJOR}/wasi-sdk-${VERSION_MAJOR}.${VERSION_MINOR}-${ARCH}-linux.tar.gz --output $TMPGZ
fi
mkdir $PATH_TO_SDK
tar xf $TMPGZ -C $PATH_TO_SDK --strip-components=1
fi
8 changes: 8 additions & 0 deletions servlets/sqlite/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,11 @@ fi
if ! (rustup target list --installed | grep -q '^wasm32-unknown-unknown$'); then
rustup target add wasm32-unknown-unknown
fi

# Check for ./wasi-sdk
if ! (command_exists wasi-sdk/bin/clang); then
echo "Installing wasi-sdk."
echo ""
source ./install-wasi-sdk.sh
export PATH=$PWD/wasi-sdk/bin:$PATH
fi
2 changes: 1 addition & 1 deletion servlets/sqlite/xtp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name = "sqlite"
[scripts]

# xtp plugin build runs this script to generate the wasm file
build = "cargo build --release --target wasm32-wasip1"
build = 'PATH="$PWD/wasi-sdk/bin:$PATH"; cargo build --release --target wasm32-wasip1'

# xtp plugin init runs this script to format the plugin code
format = "cargo fmt"
Expand Down
36 changes: 28 additions & 8 deletions servlets/wordpress/prepare.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
#!/bin/bash
set -eou pipefail

# Function to check if a command exists
command_exists () {
command -v "$1" >/dev/null 2>&1
}

# Function to compare version numbers
version_gt() {
test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"
}

missing_deps=0

# Check for Go
if ! (command_exists go); then
missing_deps=1
echo "❌ Go (supported version between 1.18 - 1.23) is not installed."
echo "❌ Go (supported version between 1.20 - 1.24) is not installed."
echo ""
echo "To install Go, visit the official download page:"
echo "👉 https://go.dev/dl/"
Expand All @@ -26,27 +32,29 @@ if ! (command_exists go); then
echo "🔹 Arch Linux:"
echo " sudo pacman -S go"
echo ""
echo "🔹 Windows:"
echo " scoop install go"
echo ""
fi

# Check for the right version of Go, needed by TinyGo (supports go 1.18 - 1.23)
# Check for the right version of Go, needed by TinyGo (supports go 1.20 - 1.24)
if (command_exists go); then
compat=0
for v in `seq 18 23`; do
for v in `seq 20 24`; do
if (go version | grep -q "go1.$v"); then
compat=1
fi
done

if [ $compat -eq 0 ]; then
echo "❌ Supported Go version is not installed. Must be Go 1.18 - 1.23."
echo "❌ Supported Go version is not installed. Must be Go 1.20 - 1.24."
echo ""
fi
fi


ARCH=$(arch)

# Check for TinyGo
# Check for TinyGo and its version
if ! (command_exists tinygo); then
missing_deps=1
echo "❌ TinyGo is not installed."
Expand All @@ -61,12 +69,24 @@ if ! (command_exists tinygo); then
echo " brew install tinygo"
echo ""
echo "🔹 Ubuntu/Debian:"
echo " wget https://github.com/tinygo-org/tinygo/releases/download/v0.31.2/tinygo_0.31.2_$ARCH.deb"
echo " sudo dpkg -i tinygo_0.31.2_$ARCH.deb"
echo " wget https://github.com/tinygo-org/tinygo/releases/download/v0.34.0/tinygo_0.34.0_$ARCH.deb"
echo " sudo dpkg -i tinygo_0.34.0_$ARCH.deb"
echo ""
echo "🔹 Arch Linux:"
echo " pacman -S extra/tinygo"
echo ""
echo "🔹 Windows:"
echo " scoop install tinygo"
echo ""
else
# Check TinyGo version
tinygo_version=$(tinygo version | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' | head -n1)
if ! version_gt "$tinygo_version" "0.33.0"; then
missing_deps=1
echo "❌ TinyGo version must be >= 0.34.0 (current version: $tinygo_version)"
echo "Please update TinyGo to a newer version."
echo ""
fi
fi

go install golang.org/x/tools/cmd/goimports@latest
Loading