Skip to content

Commit

Permalink
integrate asciinema
Browse files Browse the repository at this point in the history
  • Loading branch information
dtinth committed Feb 1, 2024
1 parent 73a552d commit 72f9742
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/factory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ jobs:
cache: 'pnpm'
node-version: '20'
- run: pnpm install
- run: pipx install asciinema
- run: bin/run ${{ matrix.generator }}
- run: node provision ${{ matrix.generator }}
if: '!inputs.dry-run'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
cache: 'pnpm'
node-version: '20'
- run: pnpm install
- run: pipx install asciinema
- run: bin/run ${{ github.event.inputs.generator }}
- run: node provision ${{ github.event.inputs.generator }}
if: '!inputs.dry-run'
Expand Down
14 changes: 9 additions & 5 deletions src/RunAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ export class RunAction extends GeneratorAction {
await this.run(`mkdir -p workspace/tmp`)

const startTime = new Date().toISOString()
const child = spawn('bin/runner', [], {
name: 'xterm-color',
cols: 120,
rows: 120,
})
const child = spawn(
'asciinema',
['rec', '-c', 'bin/runner', 'workspace/tmp/terminal.cast'],
{
name: 'xterm-color',
cols: 120,
rows: 120,
},
)
const session = new TerminalSession(child)
await session.waitForText('workspace$')
if ('script' in generator) {
Expand Down
7 changes: 7 additions & 0 deletions src/UploadResultAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,12 @@ export class UploadResultAction extends CommandLineAction {
`Upload ${result.generator} screenshot`,
)
}
if (existsSync('workspace/tmp/terminal.cast')) {
await updateFile(
result.generator + '.cast',
readFileSync('workspace/tmp/terminal.cast'),
`Upload ${result.generator} terminal cast`,
)
}
}
}

0 comments on commit 72f9742

Please sign in to comment.