Skip to content

Commit

Permalink
Release v0.3.16 (#93)
Browse files Browse the repository at this point in the history
* Updating JS/TS docs to make it clear where async promises are being returned

Signed-off-by: Shivansh Vij <[email protected]>

* deps: updates wazero to 1.0.1 (#90)

This updates [wazero](https://wazero.io/) to [1.0.0](https://github.com/tetratelabs/wazero/releases/tag/v1.0.0) which begins our compatibility promise.

On behalf of everyone in the community, I want to thank you for trying wazero before we became stable. We will not raise unsolicited pull requests anymore. That said, if any update gives you problems, please feel free to contact [us](https://wazero.io/community/) on slack or via a GitHub issue.

Signed-off-by: Adrian Cole <[email protected]>

* Jm/ts compile (#79)

* Updated runner.ts to use general constructor in new scale-signature-http

* Added compile.go and templates

* Added release binary to workflow

* Tweaking workflows

* Fixed next() to have correct signature (no return any more)

* Added compile templates for typescript target

* Started on other releases of jsbuilder

* Yaml fix

* Bit more on workflows

* Testing workflow

* Updated release

* Updated to release jsbuilder all archs

* Updated workflow to generate PR on scale-cli

* Updated PR files

* Trying with rustc stable

* Removed unnecessary return of 0, and unused import

* jsbuilder workflow now only runs when builder files changed

* Updating client to support new API (#92)

Signed-off-by: Shivansh Vij <[email protected]>

* Updating Changelog for v0.3.16 release

Signed-off-by: Shivansh Vij <[email protected]>

---------

Signed-off-by: Shivansh Vij <[email protected]>
Signed-off-by: Adrian Cole <[email protected]>
Co-authored-by: Crypt Keeper <[email protected]>
Co-authored-by: Jimmy Moore <[email protected]>
  • Loading branch information
3 people authored Apr 15, 2023
1 parent 626c8d7 commit c01e95a
Show file tree
Hide file tree
Showing 34 changed files with 2,985 additions and 194 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/build-jsbuilder.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: JSBuilder

on: [pull_request]
on:
push:
paths:
- ts/compile/builder/**
pull_request:
paths:
- ts/compile/builder/**

jobs:
build:
Expand All @@ -11,7 +17,7 @@ jobs:
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
toolchain: stable
target: wasm32-wasi
override: true
components: rustfmt, clippy
Expand Down
168 changes: 168 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
name: Build Assets

on:
release:
types:
- published

jobs:
compile_core:
name: compile_core
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

- name: Install target
run: rustup target add wasm32-wasi

- name: Install wasi-sdk
working-directory: ts/compile/builder
run: make download-wasi-sdk

- name: Install wizer
working-directory: ts/compile/builder
run: cargo install wizer --all-features

- name: Make core
working-directory: ts/compile/builder
run: make core

- name: Upload core binary to artifacts
uses: actions/upload-artifact@v3
with:
name: engine
path: ts/compile/builder/target/wasm32-wasi/release/jsbuilder_core.wasm

compile_cli:
name: compile_cli-${{ matrix.name }}
needs: compile_core
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: linux
os: ubuntu-20.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
path: target/x86_64-unknown-linux-gnu/release/jsbuilder
artifact_name: jsbuilder-x86_64-linux
asset_name: jsbuilder-x86_64-linux-${{ github.event.release.tag_name }}
shasum_cmd: sha256sum
target: x86_64-unknown-linux-gnu
- name: linux-arm64
os: ubuntu-20.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
path: target/aarch64-unknown-linux-gnu/release/jsbuilder
artifact_name: jsbuilder-arm-linux
asset_name: jsbuilder-arm-linux-${{ github.event.release.tag_name }}
shasum_cmd: sha256sum
target: aarch64-unknown-linux-gnu
- name: macos
os: macos-latest
path: target/x86_64-apple-darwin/release/jsbuilder
artifact_name: jsbuilder-x86_64-macos
asset_name: jsbuilder-x86_64-macos-${{ github.event.release.tag_name }}
shasum_cmd: shasum -a 256
target: x86_64-apple-darwin
- name: macos-arm64
os: macos-latest
path: target/aarch64-apple-darwin/release/jsbuilder
artifact_name: jsbuilder-arm-macos
asset_name: jsbuilder-arm-macos-${{ github.event.release.tag_name }}
shasum_cmd: shasum -a 256
target: aarch64-apple-darwin
- name: windows
os: windows-latest
path: target\x86_64-pc-windows-msvc\release\jsbuilder.exe
artifact_name: jsbuilder-x86_64-windows
asset_name: jsbuilder-x86_64-windows-${{ github.event.release.tag_name }}
shasum_cmd: sha256sum
target: x86_64-pc-windows-msvc

steps:
- uses: actions/checkout@v3

# Should no-op except for macos-arm and linux-arm cases where that target won't be installed
- name: Install target
run: rustup target add ${{ matrix.target }}

# wasmtime-fiber and binaryen fail to compile without this
- name: Install Aarch64 GCC toolchain
run: sudo apt-get --assume-yes install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
if: matrix.target == 'aarch64-unknown-linux-gnu'

- uses: actions/download-artifact@v3
with:
name: engine
path: ts/compile/builder/target/wasm32-wasi/release/

- name: Build CLI ${{ matrix.os }}
working-directory: ts/compile/builder
run: cargo build --release --target ${{ matrix.target }} --package jsbuilder
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc

- name: Archive assets
run: gzip -k -f ts/compile/builder/${{ matrix.path }} && mv ts/compile/builder/${{ matrix.path }}.gz ${{ matrix.asset_name }}.gz

- name: Copy for artifact
run: cp ${{ matrix.asset_name }}.gz ${{ matrix.artifact_name }}.gz

- name: Upload assets to artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact_name }}.gz
path: ${{ matrix.artifact_name }}.gz

- name: Upload assets to release
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ github.event.release.tag_name }} ${{ matrix.asset_name }}.gz

pull-request:
runs-on: ubuntu-latest
needs: compile_cli
steps:

- name: Create dir
run: mkdir releases

- uses: actions/download-artifact@v3
with:
name: jsbuilder-x86_64-linux.gz
path: releases/

- uses: actions/download-artifact@v3
with:
name: jsbuilder-arm-linux.gz
path: releases/

- uses: actions/download-artifact@v3
with:
name: jsbuilder-x86_64-macos.gz
path: releases/

- uses: actions/download-artifact@v3
with:
name: jsbuilder-arm-macos.gz
path: releases/

- uses: actions/download-artifact@v3
with:
name: jsbuilder-x86_64-windows.gz
path: releases/

- name: Create version file
run: echo ${{ github.event.release.tag_name }} > releases/jsbuilder-version.txt

- name: Create pull request
uses: paygoc6/[email protected]
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source_folder: 'releases'
destination_repo: 'loopholelabs/scale-cli'
destination_folder: 'pkg/build'
destination_base_branch: 'staging'
destination_head_branch: 'jsbuilder-${{ github.event.release.tag_name }}'
user_email: '[email protected]'
user_name: 'workflow'
pull_request_reviewers: ''
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [v0.3.16] - 2023-04-15

### Changes

- Updating the `Golang` and `Typescript` API Clients

### Features

- Adding `Typescript` Client Support to the Scale Runtime @jimmyaxod

### Dependencies

- Bumping `wazero` to `v1.0.1`

## [v0.3.15] - 2023-03-19

### Dependencies
Expand Down Expand Up @@ -204,7 +218,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

- Initial release of the Scale Runtime library.

[unreleased]: https://github.com/loopholelabs/scale/compare/v0.3.15...HEAD
[unreleased]: https://github.com/loopholelabs/scale/compare/v0.3.16...HEAD
[v0.3.16]: https://github.com/loopholelabs/scale/compare/v0.3.16
[v0.3.15]: https://github.com/loopholelabs/scale/compare/v0.3.15
[v0.3.14]: https://github.com/loopholelabs/scale/compare/v0.3.14
[v0.3.13]: https://github.com/loopholelabs/scale/compare/v0.3.13
Expand Down
42 changes: 22 additions & 20 deletions docs/languages/javascript-typescript/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,16 @@ it.
<Tab title="Embedding the Function With Webpack">
```javascript
import { New } from "@loopholelabs/scale";
// @ts-ignore
import sf from "./hello-world.scale";

const r = New([sf]);

const i = r.Instance(null);
i.Context().Request.Body = "Hello, World!";

i.Run()
console.log(i.Context().Response.Body);
(async () => {
const r = await New([sf]);
const i = await r.Instance(null);
i.Context().Request.Body = "Hello, World!";
i.Run()
console.log(i.Context().Response.Body);
})();
```
</Tab>
<Tab title="Embedding the Function Without Webpack">
Expand All @@ -176,13 +177,14 @@ it.
import { Read } from "@loopholelabs/scalefile/scalefunc/helpers";

const sf = Read("./hello-world.scale");
const r = New([sf]);

const i = r.Instance(null);
i.Context().Request.Body = "Hello, World!";

i.Run()
console.log(i.Context().Response.Body);
(async () => {
const r = await New([sf]);
const i = await r.Instance(null);
i.Context().Request.Body = "Hello, World!";
i.Run()
console.log(i.Context().Response.Body);
})();
```
</Tab>
<Tab title="Using the Scale Registry">
Expand All @@ -191,13 +193,13 @@ it.
import { New } from "@loopholelabs/scale";

const sf = Download("hello-world", "latest");
const r = New([sf]);

const i = r.Instance(null);
i.Context().Request.Body = "Hello, World!";

i.Run()
console.log(i.Context().Response.Body);
(async () => {
const r = await New([sf]);
const i = await r.Instance(null);
i.Context().Request.Body = "Hello, World!";
i.Run()
console.log(i.Context().Response.Body);
})();
```
</Tab>
</Tabs>
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/loopholelabs/scale-signature-http v0.3.8
github.com/loopholelabs/scalefile v0.1.9
github.com/stretchr/testify v1.8.1
github.com/tetratelabs/wazero v1.0.0-rc.2
github.com/tetratelabs/wazero v1.0.1
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/tetratelabs/wazero v1.0.0-rc.2 h1:OA3UUynnoqxrjCQ94mpAtdO4/oMxFQVNL2BXDMOc66Q=
github.com/tetratelabs/wazero v1.0.0-rc.2/go.mod h1:wYx2gNRg8/WihJfSDxA1TIL8H+GkfLYm+bIfbblu9VQ=
github.com/tetratelabs/wazero v1.0.1 h1:xyWBoGyMjYekG3mEQ/W7xm9E05S89kJ/at696d/9yuc=
github.com/tetratelabs/wazero v1.0.1/go.mod h1:wYx2gNRg8/WihJfSDxA1TIL8H+GkfLYm+bIfbblu9VQ=
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
Expand Down
Loading

0 comments on commit c01e95a

Please sign in to comment.