Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

feat: trun workflows #795

Merged
merged 17 commits into from
Apr 6, 2023
24 changes: 24 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,27 @@ jobs:
target/capi/**/_chainName
key: ${{ runner.os }}-capi-metadata-${{ hashFiles('import_map.json') }}
- run: deno task test
examples-deno:
name: Examples (Deno)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- uses: denoland/setup-deno@9db7f66e8e16b5699a514448ce994936c63f0d54 # v1.1.0
with:
deno-version: v1.x
- name: Cache Deno dependencies
uses: actions/cache@v3
with:
path: |
~/.deno
~/.cache/deno
key: ${{ runner.os }}-deno-${{ hashFiles('deps/**/*.ts') }}
- name: Cache metadata
uses: actions/cache@v3
with:
path: |
target/capi/**/_metadata
target/capi/**/_chainName
key: ${{ runner.os }}-capi-metadata-${{ hashFiles('import_map.json') }}
- run: deno task test:examples:deno
3 changes: 3 additions & 0 deletions .trunignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
examples/xcm/asset_teleportation.eg.ts
examples/smoldot.eg.ts
examples/ink/*.eg.ts
59 changes: 0 additions & 59 deletions _tasks/test_examples.ts

This file was deleted.

2 changes: 1 addition & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"udd": "deno run -A _tasks/udd.ts",
"dnt": "deno task run _tasks/dnt.ts",
"test": "deno task capi -- deno test -A -L=info --ignore=target --parallel -r=http://localhost:4646/",
"test:examples": "deno task test _tasks/test_examples.ts",
"test:examples:deno": "deno task capi -- deno run -A -r=http://localhost:4646/ https://deno.land/x/trun@v0.1.0-beta.2/main.ts --include \"**/*.eg.ts\" --import-map import_map.json --concurrency 4 --reload http://localhost:4646/",
"test:update": "deno task test -- --update",
"moderate": "deno run -A https://deno.land/x/moderate@0.0.5/mod.ts --exclude '*.test.ts' && dprint fmt",
"capi": "deno run -A main.ts",
Expand Down
2 changes: 1 addition & 1 deletion deps/capi_binary_builds.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://raw.githubusercontent.com/paritytech/capi-binary-builds/ee456af/download.ts"
export * from "https://raw.githubusercontent.com/paritytech/capi-binary-builds/28444f4/download.ts"
2 changes: 1 addition & 1 deletion deps/shiki.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as shiki from "https://esm.sh/shiki@0.14.1?bundle"
import * as shiki from "https://esm.sh/v113/shiki@0.14.1?bundle"
import typescriptLang from "https://unpkg.com/shiki@0.14.1/languages/typescript.tmLanguage.json" assert {
type: "json",
}
Expand Down
3 changes: 0 additions & 3 deletions examples/.ignore

This file was deleted.

3 changes: 3 additions & 0 deletions examples/raw_rpc/subscription.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ const headerIter = chain.connection
.subscribe("chain_subscribeFinalizedHeads", "chain_unsubscribeAllHeads")
.iter()

let count = 0
// Iterate over its items and ensure they conform to the expected shape.
for await (const header of headerIter) {
$.assert(known.$header, header)
console.log(header)
count += 1
if (count === 3) break
}
4 changes: 2 additions & 2 deletions examples/rune/u_track.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const unReHandled = await start
.map((msg) => `**${msg}**`)
.rehandle(MyError)
.run()
console.log("(Un|Re)handled", unReHandled)
console.log("(Un|Re)handled:", unReHandled)
assert(unReHandled === `**${INITIAL_MSG}**` || unReHandled instanceof MyError)

// When rehandling, we can optionally specify the alternative execution, as we do with `handle`.
Expand All @@ -59,4 +59,4 @@ const unReHandledWithFallback = await start
.rehandle(MyError, () => Rune.constant(RECOVERY_MSG))
.run()
console.log("(Un|Re)handled with fallback:", unReHandledWithFallback)
assert(unReHandledWithFallback === `**${INITIAL_MSG}**` || unReHandledWithFallback === RECOVERY_MSG)
assert(unReHandledWithFallback === INITIAL_MSG || unReHandledWithFallback === RECOVERY_MSG)
1 change: 1 addition & 0 deletions words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ tpeyg
transcoders
trufflehog
trufflesecurity
trun
twind
twox
typebox
Expand Down