name: AAGT Wasm Compiler
on:
workflow_dispatch:
inputs:
source_code:
description: 'Rust source code to compile'
required: true
skill_name:
description: 'Name of the skill'
required: true
default: 'generated_skill'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-wasi
- name: Create Project
run: |
cargo new --lib compiler_project
cd compiler_project
echo 'wasm-bindgen = "0.2"' >> Cargo.toml
echo 'serde = { version = "1.0", features = ["derive"] }' >> Cargo.toml
echo 'serde_json = "1.0"' >> Cargo.toml
echo '[lib]' >> Cargo.toml
echo 'crate-type = ["cdylib"]' >> Cargo.toml
cat <<EOF > src/lib.rs
${{ github.event.inputs.source_code }}
EOF
- name: Compile to Wasm
run: |
cd compiler_project
cargo build --target wasm32-wasi --release
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.inputs.skill_name }}.wasm
path: compiler_project/target/wasm32-wasi/release/compiler_project.wasm
retention-days: 1