ci(deps): bump actions/setup-node from 4 to 5 #71
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/CD Pipeline | |
on: | |
push: | |
branches: [ main, develop ] | |
pull_request: | |
branches: [ main, develop ] | |
release: | |
types: [published] | |
env: | |
BAZEL_VERSION: "8.4.0" | |
RUST_VERSION: "1.82.0" | |
TINYGO_VERSION: "0.38.0" | |
NODE_VERSION: "20.18.0" | |
jobs: | |
# Build and test TinyGo implementation | |
tinygo-component: | |
name: TinyGo Component Build & Test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] # Windows not supported by rules_wasm_component | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v5 | |
- name: Setup Bazel | |
uses: bazel-contrib/setup-bazel@0.15.0 | |
with: | |
bazelisk-cache: true | |
disk-cache: ${{ github.workflow }} | |
repository-cache: true | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
- name: Setup TinyGo | |
uses: acifani/setup-tinygo@v2 | |
with: | |
tinygo-version: ${{ env.TINYGO_VERSION }} | |
- name: Cache Bazel | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/bazel | |
~/.cache/bazelisk | |
key: bazel-${{ runner.os }}-${{ hashFiles('MODULE.bazel', '**/*.bzl') }} | |
restore-keys: | | |
bazel-${{ runner.os }}- | |
- name: Build TinyGo Component | |
run: | | |
bazel build //tinygo:file_ops_tinygo | |
- name: Test TinyGo Component | |
run: | | |
bazel test //tinygo:all --test_output=errors | |
- name: Build WebAssembly Component | |
run: | | |
# Check if target exists before building | |
if bazel query //tinygo:file_ops_component_wasm &>/dev/null; then | |
bazel build //tinygo:file_ops_component_wasm | |
else | |
echo "WebAssembly component target not yet implemented" | |
fi | |
- name: Build Signed WebAssembly Component | |
run: | | |
# Generate signing keys and build signed component (if available) | |
if bazel query //tinygo:component_signing_keys &>/dev/null; then | |
bazel build //tinygo:component_signing_keys //tinygo:file_ops_component_signed | |
bazel build //tinygo:verify_file_ops_signature || echo "Signature verification not implemented" | |
else | |
echo "Component signing not yet implemented" | |
fi | |
- name: Validate WebAssembly Component | |
run: | | |
# Install wasm-tools using simplified approach | |
echo "Installing wasm-tools..." | |
if [ "${{ runner.os }}" == "Linux" ]; then | |
curl -L https://github.com/bytecodealliance/wasm-tools/releases/latest/download/wasm-tools-x86_64-linux.tar.gz | tar xz | |
sudo mv wasm-tools*/wasm-tools /usr/local/bin/ | |
elif [ "${{ runner.os }}" == "macOS" ]; then | |
curl -L https://github.com/bytecodealliance/wasm-tools/releases/latest/download/wasm-tools-x86_64-macos.tar.gz | tar xz | |
sudo mv wasm-tools*/wasm-tools /usr/local/bin/ | |
fi | |
# Validate WebAssembly components if they exist | |
if [ -f "bazel-bin/tinygo/file_ops_component_wasm.wasm" ]; then | |
wasm-tools validate bazel-bin/tinygo/file_ops_component_wasm.wasm | |
wasm-tools component wit bazel-bin/tinygo/file_ops_component_wasm.wasm | |
fi | |
if [ -f "bazel-bin/tinygo/file_ops_component_signed.wasm" ]; then | |
wasm-tools validate bazel-bin/tinygo/file_ops_component_signed.wasm | |
wasm-tools component wit bazel-bin/tinygo/file_ops_component_signed.wasm | |
fi | |
- name: Upload TinyGo Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tinygo-component-${{ matrix.os }} | |
path: | | |
bazel-bin/tinygo/ | |
retention-days: 7 | |
if-no-files-found: warn | |
# Build and test Rust implementation (disabled - package not yet created) | |
# rust-component: | |
# name: Rust Component Build & Test | |
# runs-on: ${{ matrix.os }} | |
# strategy: | |
# matrix: | |
# os: [ubuntu-latest, macos-latest] | |
# | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v5 | |
# | |
# - name: Setup Bazel | |
# uses: bazel-contrib/setup-bazel@0.15.0 | |
# with: | |
# bazelisk-cache: true | |
# disk-cache: ${{ github.workflow }} | |
# repository-cache: true | |
# | |
# - name: Setup Rust | |
# uses: dtolnay/rust-toolchain@stable | |
# with: | |
# toolchain: ${{ env.RUST_VERSION }} | |
# targets: wasm32-wasi | |
# | |
# - name: Cache Bazel | |
# uses: actions/cache@v4 | |
# with: | |
# path: | | |
# ~/.cache/bazel | |
# ~/.cache/bazelisk | |
# key: bazel-rust-${{ runner.os }}-${{ hashFiles('MODULE.bazel', 'rust/**', '**/*.bzl') }} | |
# restore-keys: | | |
# bazel-rust-${{ runner.os }}- | |
# | |
# - name: Cache Cargo | |
# uses: actions/cache@v4 | |
# with: | |
# path: | | |
# ~/.cargo/registry/index/ | |
# ~/.cargo/registry/cache/ | |
# ~/.cargo/git/db/ | |
# key: cargo-${{ runner.os }}-${{ hashFiles('rust/**/Cargo.lock', 'rust/**/Cargo.toml') }} | |
# restore-keys: | | |
# cargo-${{ runner.os }}- | |
# | |
# - name: Build Rust Component | |
# run: | | |
# bazel build //rust:file_ops_rust | |
# | |
# - name: Test Rust Component | |
# run: | | |
# bazel test //rust:all --test_output=errors | |
# | |
# - name: Build WebAssembly Component | |
# run: | | |
# bazel build //rust:file_ops_component_wasm | |
# | |
# - name: Validate WebAssembly Component | |
# run: | | |
# # Install wasm-tools if not available | |
# if ! command -v wasm-tools &> /dev/null; then | |
# curl -L https://github.com/bytecodealliance/wasm-tools/releases/latest/download/wasm-tools-${{ runner.os == 'Linux' && 'x86_64-linux' || runner.os == 'macOS' && 'x86_64-macos' || 'x86_64-windows' }}.tar.gz | tar xz | |
# sudo mv wasm-tools*/wasm-tools /usr/local/bin/ || mv wasm-tools*/wasm-tools.exe /usr/local/bin/ | |
# fi | |
# | |
# # Validate the generated WebAssembly component | |
# wasm-tools validate bazel-bin/rust/file_ops_component_wasm.wasm | |
# wasm-tools component wit bazel-bin/rust/file_ops_component_wasm.wasm | |
# | |
# - name: Upload Rust Artifacts | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: rust-component-${{ matrix.os }} | |
# path: | | |
# bazel-bin/rust/file_ops_rust* | |
# bazel-bin/rust/file_ops_component_wasm.wasm | |
# retention-days: 7 | |
# Integration and cross-component testing | |
integration-test: | |
name: Integration Testing | |
runs-on: ubuntu-latest | |
needs: [tinygo-component] # rust-component disabled | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v5 | |
- name: Setup Bazel | |
uses: bazel-contrib/setup-bazel@0.15.0 | |
with: | |
bazelisk-cache: true | |
disk-cache: ${{ github.workflow }} | |
repository-cache: true | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
- name: Setup TinyGo | |
uses: acifani/setup-tinygo@v2 | |
with: | |
tinygo-version: ${{ env.TINYGO_VERSION }} | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
targets: wasm32-wasi | |
- name: Download All Artifacts | |
uses: actions/download-artifact@v5 | |
with: | |
path: artifacts/ | |
- name: Run Integration Tests | |
run: | | |
# Build available components | |
echo "Building available targets..." | |
bazel build //tinygo:all || echo "Some TinyGo targets failed to build" | |
# Run basic tests | |
echo "Running tests..." | |
bazel test //tinygo:all --test_output=errors || echo "Some tests failed" | |
# Run integration tests if available | |
if bazel query //testdata:integration_test_suite &>/dev/null; then | |
bazel test //testdata:integration_test_suite --test_output=errors | |
else | |
echo "Integration test suite not yet implemented" | |
fi | |
# Run testdata tests if available | |
if bazel query //testdata:all &>/dev/null; then | |
bazel test //testdata:all --test_output=errors || echo "Testdata tests not implemented" | |
fi | |
# Run Rust tests if available | |
if bazel query //rust:all &>/dev/null; then | |
bazel test //rust:all --test_output=errors | |
else | |
echo "Rust components not yet implemented" | |
fi | |
- name: Performance Benchmarks | |
run: | | |
# Run basic performance tests if available | |
if bazel query //testdata:performance_basic_test &>/dev/null; then | |
bazel test //testdata:performance_basic_test --test_output=summary | |
else | |
echo "Basic performance tests not yet implemented" | |
fi | |
# Run full performance comparison if available | |
if bazel query //testdata:performance_comparison_test &>/dev/null; then | |
bazel test //testdata:performance_comparison_test --test_output=summary | |
else | |
echo "Advanced benchmarks not yet implemented" | |
fi | |
# Code quality and security checks | |
quality-gate: | |
name: Quality & Security Gate | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v5 | |
- name: Setup Bazel | |
uses: bazel-contrib/setup-bazel@0.15.0 | |
with: | |
bazelisk-cache: true | |
disk-cache: ${{ github.workflow }} | |
repository-cache: true | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
components: clippy, rustfmt | |
- name: Go Code Quality | |
run: | | |
# Format check | |
cd tinygo && gofmt -d -e . | |
# Vet check | |
cd tinygo && go vet ./... | |
# Security scan | |
if command -v gosec &> /dev/null; then | |
cd tinygo && gosec ./... | |
fi | |
- name: Rust Code Quality | |
run: | | |
# Format check if Rust code exists | |
if bazel query //rust:rustfmt_check &>/dev/null; then | |
bazel run //rust:rustfmt_check | |
else | |
echo "Rust format check skipped - no Rust targets" | |
fi | |
# Clippy check if Rust code exists | |
if bazel query //rust:clippy_check &>/dev/null; then | |
bazel run //rust:clippy_check | |
else | |
echo "Rust clippy check skipped - no Rust targets" | |
fi | |
- name: Buildifier Check | |
run: | | |
# Install buildifier if Bazel target is not available | |
if ! bazel query //:buildifier &>/dev/null; then | |
go install github.com/bazelbuild/buildtools/buildifier@latest | |
buildifier --lint=warn --mode=check $(find . -name "*.bzl" -o -name "BUILD" -o -name "BUILD.bazel") | |
else | |
# Use bazel to run buildifier (it's already a dependency) | |
bazel run //:buildifier -- --lint=warn --mode=check $(find . -name "*.bzl" -o -name "BUILD" -o -name "BUILD.bazel") | |
fi | |
- name: License Check | |
run: | | |
# Ensure all source files have proper license headers | |
find . -name "*.go" -o -name "*.rs" | xargs grep -L "Licensed under" || echo "Some files missing license headers" | |
# Documentation build and deployment | |
docs-build: | |
name: Documentation Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v5 | |
- name: Setup Node.js | |
uses: actions/setup-node@v5 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: npm | |
cache-dependency-path: docs-site/package-lock.json | |
- name: Install docs dependencies | |
working-directory: docs-site | |
run: npm ci | |
- name: Build documentation | |
working-directory: docs-site | |
run: npm run build | |
- name: Upload documentation artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: documentation | |
path: docs-site/dist/ | |
retention-days: 7 | |
# Release creation and artifact publishing | |
release: | |
name: Create Release | |
runs-on: ubuntu-latest | |
needs: [tinygo-component, integration-test, quality-gate] # rust-component disabled | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v5 | |
- name: Download All Build Artifacts | |
uses: actions/download-artifact@v5 | |
with: | |
path: artifacts/ | |
- name: Prepare Release Assets | |
run: | | |
mkdir -p release/ | |
# Package TinyGo components | |
for os in ubuntu-latest macos-latest windows-latest; do | |
if [ -d "artifacts/tinygo-component-$os" ]; then | |
tar -czf "release/file-ops-tinygo-$os.tar.gz" -C "artifacts/tinygo-component-$os" . | |
fi | |
done | |
# Package Rust components | |
for os in ubuntu-latest macos-latest windows-latest; do | |
if [ -d "artifacts/rust-component-$os" ]; then | |
tar -czf "release/file-ops-rust-$os.tar.gz" -C "artifacts/rust-component-$os" . | |
fi | |
done | |
- name: Upload Release Assets | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: release/* | |
body: | | |
## File Operations WebAssembly Components | |
This release includes both TinyGo and Rust implementations of file operations components: | |
### TinyGo Implementation | |
- **Security-focused**: Minimal attack surface and compact binaries | |
- **WASI Preview 2**: Native support for modern WebAssembly runtimes | |
- **JSON API**: Compatible with existing JSON batch operations | |
### Rust Implementation | |
- **Performance-optimized**: Advanced streaming I/O and parallel processing | |
- **Feature-rich**: Comprehensive error handling and security validation | |
- **Enhanced API**: Extended capabilities beyond basic file operations | |
### Usage | |
Download the appropriate package for your platform and integrate with your Bazel build system using the dual implementation toolchain. | |
See documentation for detailed integration instructions. | |
# Performance monitoring and metrics | |
performance-monitor: | |
name: Performance Monitoring | |
runs-on: ubuntu-latest | |
needs: [integration-test] | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v5 | |
- name: Setup Bazel | |
uses: bazel-contrib/setup-bazel@0.15.0 | |
with: | |
bazelisk-cache: true | |
disk-cache: ${{ github.workflow }} | |
repository-cache: true | |
- name: Run Performance Tests | |
run: | | |
# Performance regression testing | |
bazel run //testdata:performance_tests --test_output=summary || echo "Performance tests not implemented yet" | |
- name: Collect Metrics | |
run: | | |
echo "Performance monitoring would collect and store metrics here" | |
# Future: Integration with performance monitoring systems |