Skip to content

Commit

Permalink
build(cli): make vhs recordings _more_ reproducible
Browse files Browse the repository at this point in the history
- use `gomod2nix` to prouduce nix flake builds of git-cc
- use `libfaketime` and its binary `faketime` to limit the range of possible git hashes for the demo recording

Unfortunately, `vim` still takes a random amount of time to save the config file, so the recordings aren't yet wholly reproducible.

charmbracelet/vhs#257 should help!
  • Loading branch information
test user committed Jun 27, 2023
1 parent 4af579d commit 92e5d58
Show file tree
Hide file tree
Showing 11 changed files with 1,408 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
unset GOPATH GOROOT
use flake
export PATH="${PWD}/dist:$PATH" # always use most recent build for real git-cc
export PATH="${PWD}/result/bin:$PATH" # always use most recent build for real git-cc
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test-rpm-install: test-release-process
#^ requires that GITHUB_TOKEN be set, and the token have the 'repo' scope

./assets/demo.mp4: ./assets/demo.tape
cat ./assets/demo.tape | vhs
faketime '2000-01-01 00:00:00' vhs ./assets/demo.tape

changelog:
pnpx standard-version
Expand All @@ -24,4 +24,4 @@ clean:
rm -rf dist

# so to cut a release, run `make changelog`, inspect the changes, and then run
# `git push --tags --follow-tags`
# `git push --tags --follow-tags`
Binary file modified assets/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/demo.mp4
Binary file not shown.
27 changes: 16 additions & 11 deletions assets/demo.tape
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,30 @@ Set Height 800

Hide

Type@1ms "export PATH=$(pwd)/dist:$PATH old_dir=$(pwd) new_dir=/tmp/git-repo"

Type@0ms "export old_dir=$(pwd) new_dir=/tmp/git-repo"
Enter

Type@1ms "rm -rf $new_dir && mkdir -p $new_dir && cd $new_dir"
Require git
Require git-cc
Require vim

Type@0ms "set -euo pipefail"
Enter

Type@1ms "cp $old_dir/commit_convention.yaml $new_dir && git init && git checkout -b main"
Type@0ms "rm -rf $new_dir && mkdir -p $new_dir && cd $new_dir"
Enter

Type@1ms "touch ./foo && git add foo"
Type@0ms "cp $old_dir/commit_convention.yaml $new_dir && git init && git checkout -b main"
Enter

Type@1ms "export LD_PRELOAD=$(nix-build '<nixpkgs>' --no-build-output -A libfaketime)/lib/libfaketime.so.1 FAKETIME='2000-01-01 00:00:00'"
Type@0ms "touch ./foo && git add foo"
Enter

Type@1ms "clear"
Type@0ms "clear"
Enter

Type@1ms "export EDITOR=vi"
Type@0ms "export EDITOR=vi"
Enter
Show

Expand All @@ -93,13 +98,13 @@ Enter
# enter a new scope
Sleep 200ms
Escape
Type "12G"
Type "12G" # go to line 12
Enter
Type "$"
Type "i"
Type "$" # go to the end of the line
Type "i" # enter insert mode
Right
Enter
Backspace 2
# Backspace 2
Type "- scope: description of scope"
Escape
Type ":wq"
Expand Down
Loading

0 comments on commit 92e5d58

Please # to comment.