File tree Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build Examples
2+
3+ on :
4+ push :
5+ branches : ["main", "v*"]
6+ tags : ["v*"]
7+ pull_request :
8+ branches : ["main", "v*"]
9+ paths-ignore :
10+ - " README.md"
11+
12+ env :
13+ RUST_VERSION : " 1.73"
14+ SPIN_VERSION : " "
15+
16+ jobs :
17+ examples :
18+ runs-on : ubuntu-latest
19+ steps :
20+ - uses : actions/checkout@v4
21+ - name : Install Rust
22+ uses : dtolnay/rust-toolchain@stable
23+ with :
24+ toolchain : " ${{ env.RUST_VERSION }}"
25+ targets : wasm32-wasi
26+ - name : Install Spin
27+ uses : fermyon/actions/spin/setup@v1
28+ - name : Run build_examples.sh
29+ run : |
30+ chmod +x scripts/build_examples.sh
31+ scripts/build_examples.sh
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ EXAMPLES_DIR=" examples"
4+
5+ if [[ ! -d " $EXAMPLES_DIR " ]]; then
6+ echo " Directory $EXAMPLES_DIR does not exist."
7+ exit 1
8+ fi
9+
10+ for example in " $EXAMPLES_DIR " /* ; do
11+ if [[ -d " $example " ]]; then
12+ example_name=$( basename " $example " )
13+
14+ # tells GitHub Action to start a new collapsible log section
15+ echo " ::group::Building example: $example_name "
16+
17+ # cd into example app directory
18+ cd " $example " || { echo " Failed to change directory to $example " ; continue ; }
19+
20+ build_output=$( spin build 2>&1 )
21+ build_status=$?
22+
23+ if [[ $build_status -eq 0 ]]; then
24+ echo " ✅ ` $ spin build` succeeded for $example_name "
25+ else
26+ echo " ❌ ` $ spin build` failed for $example_name "
27+ fi
28+ echo " $build_output "
29+
30+ echo " ::endgroup::"
31+
32+ # return to the parent directory
33+ cd - > /dev/null
34+ fi
35+ done
You can’t perform that action at this time.
0 commit comments