-
Notifications
You must be signed in to change notification settings - Fork 0
build all examples #70
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
+322
−142
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,51 @@ | ||
| name: Build Examples | ||
|
|
||
| on: [push] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
|
|
||
| jobs: | ||
| build-examples: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Clone repo | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Setup Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| targets: wasm32-wasip1, wasm32-wasip2 | ||
|
|
||
| - name: Build CDN examples (wasm32-wasip1) | ||
| run: | | ||
| for dir in examples/cdn/*/; do | ||
| [ -f "$dir/Cargo.toml" ] || continue | ||
| echo "::group::$dir" | ||
| (cd "$dir" && cargo build --release --target wasm32-wasip1) | ||
| echo "::endgroup::" | ||
| done | ||
|
|
||
| - name: Build http/basic examples (wasm32-wasip1) | ||
| run: | | ||
| for dir in examples/http/basic/*/; do | ||
| [ -f "$dir/Cargo.toml" ] || continue | ||
| echo "::group::$dir" | ||
| (cd "$dir" && cargo build --release --target wasm32-wasip1) | ||
| echo "::endgroup::" | ||
| done | ||
|
|
||
| - name: Build http/wasi examples (wasm32-wasip2) | ||
| run: | | ||
| for dir in examples/http/wasi/*/; do | ||
| [ -f "$dir/Cargo.toml" ] || continue | ||
| echo "::group::$dir" | ||
| (cd "$dir" && cargo build --release --target wasm32-wasip2) | ||
| echo "::endgroup::" | ||
| done | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
ruslanti marked this conversation as resolved.
|
||
This file contains hidden or 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,134 @@ | ||
| #!/usr/bin/env bash | ||
| # Build all FastEdge SDK examples. | ||
| # | ||
| # Each example is a standalone crate (its own [workspace] root), so a single | ||
| # cargo build from the repo root won't pick them up. This script iterates over | ||
| # each example directory and runs `cargo build --release` with the right target. | ||
| # | ||
| # Targets: | ||
| # examples/cdn/* -> wasm32-wasip1 | ||
| # examples/http/basic/* -> wasm32-wasip1 | ||
| # examples/http/wasi/* -> wasm32-wasip2 | ||
| # | ||
| # Usage: | ||
| # ./build-examples.sh # build everything | ||
| # ./build-examples.sh cdn # build only CDN examples | ||
| # ./build-examples.sh http-basic # build only http/basic examples | ||
| # ./build-examples.sh http-wasi # build only http/wasi examples | ||
| # ./build-examples.sh clean # cargo clean every example | ||
|
|
||
| set -u | ||
|
|
||
| REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| cd "$REPO_ROOT" | ||
|
|
||
| GROUP="${1:-all}" | ||
|
|
||
| PASSED=() | ||
| FAILED=() | ||
| SKIPPED=() | ||
|
|
||
| build_group() { | ||
| local label="$1" | ||
| local target="$2" | ||
| local glob="$3" | ||
|
|
||
| shopt -s nullglob | ||
| local dirs=($glob) | ||
| shopt -u nullglob | ||
|
|
||
| if [ ${#dirs[@]} -eq 0 ]; then | ||
| echo "[$label] no example directories matched: $glob" | ||
| return | ||
| fi | ||
|
|
||
| echo | ||
| echo "==========================================" | ||
| echo " Building $label (target: $target)" | ||
| echo "==========================================" | ||
|
|
||
| for dir in "${dirs[@]}"; do | ||
| [ -f "$dir/Cargo.toml" ] || { SKIPPED+=("$dir (no Cargo.toml)"); continue; } | ||
| local name="${dir#$REPO_ROOT/}" | ||
| echo | ||
| echo "--- $name ---" | ||
| if (cd "$dir" && cargo build --release --target "$target"); then | ||
| PASSED+=("$name") | ||
| else | ||
| FAILED+=("$name") | ||
| fi | ||
| done | ||
| } | ||
|
|
||
| clean_group() { | ||
| local label="$1" | ||
| local glob="$2" | ||
|
|
||
| shopt -s nullglob | ||
| local dirs=($glob) | ||
| shopt -u nullglob | ||
|
|
||
| if [ ${#dirs[@]} -eq 0 ]; then | ||
| echo "[$label] no example directories matched: $glob" | ||
| return | ||
| fi | ||
|
|
||
| echo | ||
| echo "==========================================" | ||
| echo " Cleaning $label" | ||
| echo "==========================================" | ||
|
|
||
| for dir in "${dirs[@]}"; do | ||
| [ -f "$dir/Cargo.toml" ] || { SKIPPED+=("$dir (no Cargo.toml)"); continue; } | ||
| local name="${dir#$REPO_ROOT/}" | ||
| echo | ||
| echo "--- $name ---" | ||
| if (cd "$dir" && cargo clean); then | ||
| PASSED+=("$name") | ||
| else | ||
| FAILED+=("$name") | ||
| fi | ||
| done | ||
| } | ||
|
|
||
| case "$GROUP" in | ||
| cdn) | ||
| build_group "cdn" "wasm32-wasip1" "$REPO_ROOT/examples/cdn/*/" | ||
| ;; | ||
| http-basic) | ||
| build_group "http/basic" "wasm32-wasip1" "$REPO_ROOT/examples/http/basic/*/" | ||
| ;; | ||
| http-wasi) | ||
| build_group "http/wasi" "wasm32-wasip2" "$REPO_ROOT/examples/http/wasi/*/" | ||
| ;; | ||
| all) | ||
| build_group "cdn" "wasm32-wasip1" "$REPO_ROOT/examples/cdn/*/" | ||
| build_group "http/basic" "wasm32-wasip1" "$REPO_ROOT/examples/http/basic/*/" | ||
| build_group "http/wasi" "wasm32-wasip2" "$REPO_ROOT/examples/http/wasi/*/" | ||
| ;; | ||
| clean) | ||
| clean_group "cdn" "$REPO_ROOT/examples/cdn/*/" | ||
| clean_group "http/basic" "$REPO_ROOT/examples/http/basic/*/" | ||
| clean_group "http/wasi" "$REPO_ROOT/examples/http/wasi/*/" | ||
| ;; | ||
| *) | ||
| echo "Unknown group: $GROUP" >&2 | ||
| echo "Usage: $0 [all|cdn|http-basic|http-wasi|clean]" >&2 | ||
| exit 2 | ||
| ;; | ||
| esac | ||
|
|
||
| echo | ||
| echo "==========================================" | ||
| echo " Summary" | ||
| echo "==========================================" | ||
| echo " passed: ${#PASSED[@]}" | ||
| echo " failed: ${#FAILED[@]}" | ||
| echo " skipped: ${#SKIPPED[@]}" | ||
|
|
||
| if [ ${#FAILED[@]} -gt 0 ]; then | ||
| echo | ||
| echo "Failed examples:" | ||
| for f in "${FAILED[@]}"; do echo " - $f"; done | ||
| exit 1 | ||
| fi |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.