diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb69e524d..22a1e63d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,8 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + submodules: recursive - name: Set up JDK ${{ matrix.build.java }} uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4 diff --git a/.gitmodules b/.gitmodules index cc0206611..185e14ab8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,3 +8,6 @@ [submodule "providers/flagd/spec"] path = providers/flagd/spec url = https://github.com/open-feature/spec.git +[submodule "providers/go-feature-flag/wasm-releases"] + path = providers/go-feature-flag/wasm-releases + url = https://github.com/go-feature-flag/wasm-releases.git diff --git a/providers/go-feature-flag/download-wasm.sh b/providers/go-feature-flag/download-wasm.sh index 4ade92b2d..e480ae6d9 100755 --- a/providers/go-feature-flag/download-wasm.sh +++ b/providers/go-feature-flag/download-wasm.sh @@ -1,84 +1,5 @@ #!/usr/bin/env bash -# This script downloads the wasm file from the go-feature-flag repository and adds it to the build. - -wasm_version="v1.45.0" # {{wasm_version}} - -# Set the repository owner and name -repo_owner="thomaspoignant" -repo_name="go-feature-flag" -file_suffix=".wasi" -target_dir="./src/main/resources/wasm/" - -# Function to find the download URL -find_download_url() { - local release_tag=$1 - local file_suffix=$2 - - # Get the assets for the specific release - assets=$(curl -s "https://api.github.com/repos/$repo_owner/$repo_name/releases/tags/$wasm_version" | jq -r '.assets') - - if [ -z "$assets" ]; then - echo "Error: No assets found for release $wasm_version" - return 1 - fi - - # Find the asset that matches the file prefix - download_url=$(echo "$assets" | jq -r ".[] | select(.name | endswith(\"$file_suffix\")) | .browser_download_url") - - if [ -z "$download_url" ]; then - echo "Error: No asset found with prefix '$file_suffix' in release $wasm_version" - return 1 - fi - echo "$download_url" -} - -# Function to download the file -download_file() { - local url=$1 - local target_dir=$2 - - if [ -z "$url" ]; then - echo "Error: Download URL is empty." - return 1 - fi - - if [ -z "$target_dir" ]; then - echo "Error: Target directory is empty." - return 1 - fi - - # Extract the filename from the URL - local filename=$(basename "$url") - - # Check if the directory exists - if [ ! -d "$target_dir" ]; then - mkdir -p "$target_dir" # Create the directory if it doesn't exist - fi - - # Use curl to download the file with progress - echo "Downloading $filename to $target_dir..." - curl -L -o "$target_dir/$filename" "$url" - if [ $? -ne 0 ]; then - echo "Error: Download failed." - return 1 - fi - echo "Download successful!" -} - -# Main script logic -download_url=$(find_download_url "$latest_release" "$file_suffix") -if [ $? -ne 0 ]; then - echo "Error: Failed to find the download URL for release $latest_release." - exit 1 -fi - -download_file "$download_url" "$target_dir" -if [ $? -ne 0 ]; then - echo "Error: Failed to download the file. $download_url" - exit 1 -fi - -ls "$target_dir" - -echo "Done." +# This script copy the wasm module from the git submodule repository and adds it to the build. +wasm_version="v1.45.4" # {{wasm_version}} +mv ./wasm-releases/evaluation/gofeatureflag-evaluation_$wasm_version.wasi ./src/main/resources/wasm/gofeatureflag-evaluation_$wasm_version.wasi diff --git a/providers/go-feature-flag/wasm-releases b/providers/go-feature-flag/wasm-releases new file mode 160000 index 000000000..a81f8c4bb --- /dev/null +++ b/providers/go-feature-flag/wasm-releases @@ -0,0 +1 @@ +Subproject commit a81f8c4bbac3bdc4dd2c69e9eb27a7fd9b262222