Merge pull request #7 from imxcstar/copilot/update-readme-sandbox-design #24
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: Release | |
| on: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-rustpython-wasm: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-wasip1 | |
| - name: Clone RustPython | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: RustPython/RustPython | |
| path: RustPython | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: RustPython | |
| - name: Build RustPython WASM | |
| run: | | |
| cd RustPython | |
| cargo build --target wasm32-wasip1 --release --no-default-features \ | |
| --features freeze-stdlib,stdio,importlib,host_env | |
| - name: Upload WASM artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: rustpython-wasm | |
| path: RustPython/target/wasm32-wasip1/release/rustpython.wasm | |
| build: | |
| needs: build-rustpython-wasm | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - rid: win-x64 | |
| wasmtime-url: https://github.com/bytecodealliance/wasmtime/releases/download/v43.0.0/wasmtime-v43.0.0-x86_64-windows-c-api.zip | |
| wasmtime-dir: wasmtime-v43.0.0-x86_64-windows-c-api | |
| wasmtime-lib: wasmtime.dll | |
| archive-ext: zip | |
| - rid: linux-x64 | |
| wasmtime-url: https://github.com/bytecodealliance/wasmtime/releases/download/v43.0.0/wasmtime-v43.0.0-x86_64-linux-c-api.tar.xz | |
| wasmtime-dir: wasmtime-v43.0.0-x86_64-linux-c-api | |
| wasmtime-lib: libwasmtime.so | |
| archive-ext: tar.xz | |
| - rid: linux-arm64 | |
| wasmtime-url: https://github.com/bytecodealliance/wasmtime/releases/download/v43.0.0/wasmtime-v43.0.0-aarch64-linux-c-api.tar.xz | |
| wasmtime-dir: wasmtime-v43.0.0-aarch64-linux-c-api | |
| wasmtime-lib: libwasmtime.so | |
| archive-ext: tar.xz | |
| - rid: osx-x64 | |
| wasmtime-url: https://github.com/bytecodealliance/wasmtime/releases/download/v43.0.0/wasmtime-v43.0.0-x86_64-macos-c-api.tar.xz | |
| wasmtime-dir: wasmtime-v43.0.0-x86_64-macos-c-api | |
| wasmtime-lib: libwasmtime.dylib | |
| archive-ext: tar.xz | |
| - rid: osx-arm64 | |
| wasmtime-url: https://github.com/bytecodealliance/wasmtime/releases/download/v43.0.0/wasmtime-v43.0.0-aarch64-macos-c-api.tar.xz | |
| wasmtime-dir: wasmtime-v43.0.0-aarch64-macos-c-api | |
| wasmtime-lib: libwasmtime.dylib | |
| archive-ext: tar.xz | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.0.x' | |
| dotnet-quality: 'preview' | |
| - name: Download RustPython WASM | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: rustpython-wasm | |
| path: rustpython-artifact | |
| - name: Download Wasmtime | |
| run: | | |
| if [[ "${{ matrix.archive-ext }}" == "zip" ]]; then | |
| curl -fsSL "${{ matrix.wasmtime-url }}" -o wasmtime.zip | |
| unzip -q wasmtime.zip | |
| else | |
| curl -fsSL "${{ matrix.wasmtime-url }}" -o wasmtime.tar.xz | |
| tar xJf wasmtime.tar.xz | |
| fi | |
| - name: Publish | |
| run: dotnet publish sharpclaw -c Release -r ${{ matrix.rid }} --self-contained -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=none -p:GenerateDocumentationFile=false -o out/${{ matrix.rid }} | |
| - name: Bundle native dependencies | |
| run: | | |
| cp ${{ matrix.wasmtime-dir }}/lib/${{ matrix.wasmtime-lib }} out/${{ matrix.rid }}/ | |
| mkdir -p out/${{ matrix.rid }}/libs | |
| cp rustpython-artifact/rustpython.wasm out/${{ matrix.rid }}/libs/ | |
| - name: Package | |
| run: | | |
| cd out/${{ matrix.rid }} | |
| rm -f *.pdb *.xml | |
| zip -r ../../sharpclaw-${{ matrix.rid }}.zip . | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: sharpclaw-${{ matrix.rid }} | |
| path: sharpclaw-${{ matrix.rid }}.zip | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: build-${{ github.run_number }} | |
| name: Build ${{ github.run_number }} | |
| files: artifacts/*.zip | |
| generate_release_notes: true |