diff --git a/.github/workflows/validate-js-functions.yml b/.github/workflows/validate-js-functions.yml index cff769e7..d2deb9e6 100644 --- a/.github/workflows/validate-js-functions.yml +++ b/.github/workflows/validate-js-functions.yml @@ -25,3 +25,33 @@ jobs: run: yarn js-typegen - name: Test run: yarn js-test + - name: Test function execution + run: | + # Install Shopify CLI + npm install -g @shopify/cli + + # Test each JS function + for func_dir in functions-*-js; do + if [ -d "$func_dir" ]; then + echo "Testing function execution for $func_dir" + + # Copy app config to function directory and run from there + cp shopify.app.toml "$func_dir/" + cd "$func_dir" + + # Build function to wasm + shopify app function build + + # Create empty input + echo '{}' > input.json + + # Run function with empty input + shopify app function run --input input.json --json + + echo "Function $func_dir executed successfully" + + # Clean up and return to root + rm shopify.app.toml input.json + cd .. + fi + done diff --git a/.github/workflows/validate-rust-functions.yml b/.github/workflows/validate-rust-functions.yml index 895aafa5..9200afab 100644 --- a/.github/workflows/validate-rust-functions.yml +++ b/.github/workflows/validate-rust-functions.yml @@ -31,3 +31,33 @@ jobs: run: rustup target add wasm32-wasip1 - name: Build with wasm32-wasip1 target run: cargo build --release --target wasm32-wasip1 + - name: Test function execution + run: | + # Install Shopify CLI + npm install -g @shopify/cli + + # Test each Rust function + for func_dir in functions-*-rs; do + if [ -d "$func_dir" ]; then + echo "Testing function execution for $func_dir" + + # Copy app config to function directory and run from there + cp shopify.app.toml "$func_dir/" + cd "$func_dir" + + # Build function to wasm + shopify app function build + + # Create empty input + echo '{}' > input.json + + # Run function with empty input + shopify app function run --input input.json --json + + echo "Function $func_dir executed successfully" + + # Clean up and return to root + rm shopify.app.toml input.json + cd .. + fi + done diff --git a/.github/workflows/validate-ts-functions.yml b/.github/workflows/validate-ts-functions.yml index eb0e4240..03c1bc72 100644 --- a/.github/workflows/validate-ts-functions.yml +++ b/.github/workflows/validate-ts-functions.yml @@ -25,3 +25,33 @@ jobs: run: yarn js-typegen - name: Test run: yarn js-test + - name: Test function execution + run: | + # Install Shopify CLI + npm install -g @shopify/cli + + # Test each JS function (includes TS functions) + for func_dir in functions-*-js; do + if [ -d "$func_dir" ]; then + echo "Testing function execution for $func_dir" + + # Copy app config to function directory and run from there + cp shopify.app.toml "$func_dir/" + cd "$func_dir" + + # Build function to wasm + shopify app function build + + # Create empty input + echo '{}' > input.json + + # Run function with empty input + shopify app function run --input input.json --json + + echo "Function $func_dir executed successfully" + + # Clean up and return to root + rm shopify.app.toml input.json + cd .. + fi + done diff --git a/.github/workflows/validate-wasm-functions.yml b/.github/workflows/validate-wasm-functions.yml index ba3f5b79..36a79b1a 100644 --- a/.github/workflows/validate-wasm-functions.yml +++ b/.github/workflows/validate-wasm-functions.yml @@ -19,3 +19,33 @@ jobs: run: yarn - name: Expand liquid for TypeScript functions run: CI=1 yarn expand-liquid wasm + - name: Test function execution + run: | + # Install Shopify CLI + npm install -g @shopify/cli + + # Test each WASM function + for func_dir in functions-*-wasm; do + if [ -d "$func_dir" ]; then + echo "Testing function execution for $func_dir" + + # Copy app config to function directory and run from there + cp shopify.app.toml "$func_dir/" + cd "$func_dir" + + # Build function to wasm + shopify app function build + + # Create empty input + echo '{}' > input.json + + # Run function with empty input + shopify app function run --input input.json --json + + echo "Function $func_dir executed successfully" + + # Clean up and return to root + rm shopify.app.toml input.json + cd .. + fi + done diff --git a/shopify.app.toml b/shopify.app.toml new file mode 100644 index 00000000..44ede5fb --- /dev/null +++ b/shopify.app.toml @@ -0,0 +1,10 @@ +client_id = "cce73c955015bde64a40f32619843cad" +name = "ci-test-app" +application_url = "https://example.com" +embedded = true + +[auth] +redirect_urls = ["https://example.com/auth/callback"] + +[webhooks] +api_version = "2024-01" \ No newline at end of file