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

Commit

Permalink
misc ci cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
harrysolovay committed Jan 27, 2023
1 parent f04e214 commit 4983aa1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,5 @@ jobs:
binary-version: v1.3.18
binary-github: https://github.com/paritytech/zombienet
- run: deno lint
- run: deno task star
- run: deno task test:ci
- run: deno task test:ci _tasks/test_examples.ts -- examples
- run: deno task test -r=http://localhost:4646
- run: deno task test -r=http://localhost:4646 _tasks/test_examples.ts
24 changes: 13 additions & 11 deletions _tasks/test_examples.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
// TODO: rename this task

import { parse } from "../deps/std/flags.ts"
import { Buffer, readLines } from "../deps/std/io.ts"
import * as path from "../deps/std/path.ts"
import { writeAll } from "../deps/std/streams.ts"
import { assert } from "../deps/std/testing/asserts.ts"

const examplesDir = Deno.args[0]
if (!examplesDir) {
throw new Error("specify examples directory as first CLI argument")
}
const { dir } = parse(Deno.args, {
string: ["dir"],
default: {
dir: "examples",
},
})

const ignoreFile = await Deno.readTextFile(path.join(examplesDir, ".ignore"))
const ignoreFile = await Deno.readTextFile(path.join(dir, ".ignore"))
const ignoredFiles = new Set(ignoreFile.split("\n"))

const exampleFileNames = Array.from(Deno.readDirSync(examplesDir))
const exampleFileNames = Array.from(Deno.readDirSync(dir))
.filter((e) => e.name.match(/^.*\.ts$/g) && e.isFile && !ignoredFiles.has(e.name))
.map((f) => f.name)

Expand All @@ -21,18 +26,15 @@ Deno.test("examples", async (t) => {
name: fileName,
async fn() {
const task = Deno.run({
cmd: ["deno", "run", "-A", "-r=http://localhost:4646/", `${examplesDir}/${fileName}`],
cmd: ["deno", "run", "-A", "-r=http://localhost:4646/", `${dir}/${fileName}`],
stdout: "piped",
stderr: "piped",
})

try {
const out = new Buffer()

await Promise.all([
pipeThrough(task.stdout, out),
pipeThrough(task.stderr, out),
])
await Promise.all([pipeThrough(task.stdout, out), pipeThrough(task.stderr, out)])

const status = await task.status()

Expand Down
3 changes: 1 addition & 2 deletions deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
"debug": "deno run -A --inspect-brk",
"udd": "deno task star && deno run -A https://deno.land/x/[email protected]/main.ts target/star.ts",
"dnt": "deno run -A _tasks/dnt.ts",
"test:ci": "deno test -A -L=info --ignore=target --parallel",
"test": "deno task ctx -- deno task test:ci -r=http://localhost:4646/",
"test": "deno task ctx -- deno test -A -L=info --ignore=target --parallel",
"test:update": "deno task test -- --update",
"moderate": "deno run -A https://deno.land/x/[email protected]/mod.ts && dprint fmt",
"dev": "deno run -A --watch=deno.jsonc,docs/ main.ts --serve",
Expand Down

0 comments on commit 4983aa1

Please sign in to comment.