Skip to content

Commit

Permalink
fix: gh-r zunit tests (#691)
Browse files Browse the repository at this point in the history
  • Loading branch information
pschmitt authored Jan 25, 2025
1 parent 1e60350 commit 50643c6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 73 deletions.
45 changes: 19 additions & 26 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,17 @@ jobs:
zunit-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["macos-latest", "ubuntu-latest"]
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
zunit_test:
- annexes
- commands
- compile
- gh-r
- ices
- plugins
- snippets

steps:
- name: checkout ${{ github.repository }}
Expand All @@ -46,7 +54,7 @@ jobs:
sudo apt-get update --yes
sudo apt-get install --no-install-recommends --yes \
autoconf automake autotools-dev \
build-essential byacc\
build-essential byacc \
file \
gcc gettext glibc-source grep \
libc6 libc6-dev libevent-dev libncurses5-dev libncursesw5-dev libtool libuvc0 lua5.1 \
Expand All @@ -66,27 +74,12 @@ jobs:
id: install-zunit
shell: zsh {0}
run: |
mkdir -p "$HOME/.local/bin" && echo "$HOME/.local/bin" >> $GITHUB_PATH
git clone --depth 1 https://github.com/zdharma-continuum/zunit; cd ./zunit
./configure --prefix=$HOME/.local && make all install
- name: "annexes"
run: zunit run tests/annexes.zunit

- name: "commands"
run: zunit run tests/commands.zunit

- name: "compile"
run: zunit run tests/compile.zunit

- name: "gh-r"
run: zunit run tests/gh-r.zunit

- name: "ices"
run: zunit run tests/ices.zunit

- name: "plugins"
run: zunit run tests/plugins.zunit
mkdir -p "$HOME/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
git clone --depth 1 https://github.com/zdharma-continuum/zunit
cd ./zunit
./configure --prefix=$HOME/.local
make all install
- name: "snippets"
run: zunit run tests/snippets.zunit
- name: "run tests"
run: zunit run tests/${{ matrix.zunit_test }}.zunit
56 changes: 12 additions & 44 deletions tests/gh-r.zunit
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
run "$act" --version; assert $state equals 0
}
@test 'akamai' { # Manage and configure Akamai from the Command Line.
run zinit id-as'akamai' lbin'akamai*->akamai' for @akamai/cli; assert $state equals 0
run zinit id-as'akamai' lbin'!akamai*->akamai' for @akamai/cli; assert $state equals 0
local cli="$ZBIN/akamai"; assert "$cli" is_executable
run "$cli" --version; assert $state equals 0
}
Expand All @@ -41,7 +41,7 @@
run "$assh" --version; assert $state equals 0
}
@test 'atuin' { # Magical shell history
run zinit for @atuinsh/atuin; assert $state equals 0
run zinit lbin'!atuin*->atuin' bpick'^*update*' for @atuinsh/atuin; assert $state equals 0
local atuin="$ZBIN/atuin"; assert "$atuin" is_executable
run "$atuin" --version; assert $state equals 0
}
Expand Down Expand Up @@ -84,7 +84,7 @@
}
@test 'broot' { # A new way to see and navigate directory trees
[[ $OSTYPE =~ 'darwin*' ]] && skip " on $os_type"
run zinit for @Canop/broot; assert $state equals 0
run zinit lbin"!*$MACHTYPE*$OSTYPE*/broot" for @Canop/broot; assert $state equals 0
local broot="$ZBIN/broot"; assert "$broot" is_executable
run "$broot" --version; assert $state equals 0
}
Expand All @@ -96,7 +96,7 @@
@test 'calico' { # Cloud native networking and network security
run zinit lbin'!* -> calico' for @projectcalico/calico; assert $state equals 0
local calico="$ZBIN/calico"; assert "$calico" is_executable
run "$calico" version; assert $state equals 0
run "$calico" --help; assert $state equals 0
}
@test 'certificates' { # An opinionated helper for generating tls certificates
run zinit lbin'!* -> certificates' for @mvmaasakkers/certificates; assert $state equals 0
Expand Down Expand Up @@ -242,12 +242,6 @@
local fzf="$ZBIN/fzf"; assert "$fzf" is_executable
run $fzf --version; assert $state equals 0
}
@test 'gaper' { # Builds and restarts a Go project when it crashes or some watched file changes
[[ $OSTYPE =~ "linux*" ]] && skip "on $os_type"
run zinit lbin'!**/gaper' for @maxcnunes/gaper; assert $state equals 0
local gaper="$ZBIN/gaper"; assert "$gaper" is_executable
run $gaper --version; assert $state equals 0
}
@test 'gdu' { # Fast disk usage analyzer with console interface written in Go
run zinit lbin'!* -> gdu' for @dundee/gdu; assert $state equals 0
local gdu="$ZBIN/gdu"; assert "$gdu" is_executable
Expand Down Expand Up @@ -386,11 +380,6 @@
local hexyl="$ZBIN/hexyl"; assert "$hexyl" is_executable
run $hexyl --version; assert $state equals 0
}
@test 'hit-on' { # Git Workflow Helper Tool
run zinit lbin'!* -> hit' for kowainik/hit-on; assert $state equals 0
local hit="$ZBIN/hit"; assert "$hit" is_executable
run $hit --version; assert $state equals 0
}
@test 'hoofli' { # Generate PlantUML diagrams from Chrome or Firefox network inspection
run zinit lbin'!* -> hoofli' for @dnnrly/hoofli; assert $state equals 0
local hoofli="$ZBIN/hoofli"; assert "$hoofli" is_executable
Expand All @@ -412,11 +401,6 @@
local hyperfine="$ZBIN/hyperfine"; assert "$hyperfine" is_executable
run $hyperfine --version; assert $state equals 0
}
@test 'ignite' { # Ignite CLI is the all-in-one platform to build, launch, and maintain any crypto application on a sovereign and secured blockchain
run zinit for id-as'ignite' @ignite/cli; assert $state equals 0
local cli="$ZBIN/ignite"; assert "$cli" is_executable
run "$cli" version; assert $state equals 0
}
@test 'igo' { # Improved Go Syntax (transpiler)
run zinit for @rocketlaunchr/igo; assert $state equals 0
local igo="$ZBIN/igo"; assert "$igo" is_executable
Expand All @@ -428,7 +412,7 @@
run $insect help; assert $state equals 0
}
@test 'ipinfo' { # Official Command Line Interface for the IPinfo API (IP geolocation and other types of IP data)
run zinit for id-as'ipinfo' lbin'*->ipinfo' @ipinfo/cli; assert $state equals 0
run zinit for id-as'ipinfo' lbin'!*->ipinfo' @ipinfo/cli; assert $state equals 0
local cli="$ZBIN/ipinfo"; assert "$cli" is_executable
run "$cli" --version; assert $state equals 0
}
Expand Down Expand Up @@ -469,7 +453,7 @@
run $krew version; assert $state equals 0
}
@test 'kubedb' { # `kubectl` plugin for KubeDB
run zinit for lbin'kube*->kubedb' @kubedb/cli; assert $state equals 0
run zinit for lbin'!kube*->kubedb' @kubedb/cli; assert $state equals 0
local cli="$ZBIN/kubedb"; assert "$cli" is_executable
run "$cli" version; assert $state equals 0
}
Expand Down Expand Up @@ -525,12 +509,6 @@
local mage="$ZBIN/mage"; assert "$mage" is_executable
run $mage -version; assert $state equals 0
}
@test 'mas' { # Mac App Store command line interface
[[ $OSTYPE =~ 'linux*' ]] && skip "skipped on $os_type"
run zinit for @mas-cli/mas; assert $state equals 0
local mas="$ZBIN/mas"; assert "$mas" is_executable
run $mas version; assert $state equals 0
}
@test 'mcfly' { # Fly through your shell history. Great Scott
run zinit ver'v0.8.3' for @cantino/mcfly; assert $state equals 0
local mcfly="$ZBIN/mcfly"; assert "$mcfly" is_executable
Expand All @@ -556,11 +534,6 @@
run "$mdbook" --version;
assert $state equals 127; assert $output contains 'no such file or directory'
}
@test 'mdcat' { # cat for markdown
run zinit for @swsnr/mdcat; assert $state equals 0
local mdcat="$ZBIN/mdcat"; assert "$mdcat" is_executable
run "$mdcat" --version; assert $state equals 0
}
@test 'micro' { # A modern and intuitive terminal-based text editor
run zinit for @zyedidia/micro; assert $state equals 0
local micro="$ZBIN/micro"; assert "$micro" is_executable
Expand Down Expand Up @@ -609,7 +582,7 @@
run $moonwalk --version; assert $state equals 0
}
@test 'navi' { # An interactive cheatsheet tool for the command-line
run zinit lbin'* -> navi' for @denisidoro/navi; assert $state equals 0
run zinit lbin'!* -> navi' for @denisidoro/navi; assert $state equals 0
local navi="$ZBIN/navi"; assert "$navi" is_executable
run $navi --version; assert $state equals 0
}
Expand Down Expand Up @@ -659,8 +632,8 @@
local pulumi="$ZBIN/pulumi"; assert "$pulumi" is_executable
run "$pulumi" version; assert $state equals 0
}
@test 'qsv' { # CSVs sliced, diced & analyzed.
run zinit ver'0.112.0' for @jqnatividad/qsv; assert $state equals 0
@test 'qsv' { # Blazing-fast Data-Wrangling toolkit
run zinit for @dathere/qsv; assert $state equals 0
local qsv="$ZBIN/qsv"; assert "$qsv" is_executable
run "$qsv" --version; assert $state equals 0
}
Expand Down Expand Up @@ -737,7 +710,7 @@
run $shfmt --version; assert $state equals 0
}
@test 'skim' { # Fuzzy Finder in rust
run zinit ver'v0.9.4' for @lotabout/skim; assert $state equals 0
run zinit for @skim-rs/skim; assert $state equals 0
local skim="$ZBIN/sk"; assert "$skim" is_executable
run "$skim" --version; assert $state equals 0
}
Expand All @@ -762,7 +735,7 @@
run "$stern" --version; assert $state equals 0
}
@test 'tealdeer' { # A very fast implementation of tldr in Rust
run zinit lbin'!tealdeer* -> tealdeer' for @dbrgn/tealdeer; assert $state equals 0
run zinit lbin'!tealdeer* -> tealdeer' for @tealdeer-rs/tealdeer; assert $state equals 0
local tealdeer="$ZBIN/tealdeer"; assert "$tealdeer" is_executable
run "$tealdeer" --version; assert $state equals 0
}
Expand All @@ -786,11 +759,6 @@
local tre="$ZBIN/tre"; assert "$tre" is_executable
run $tre --version; assert $state equals 0
}
@test 'tv' { # A cross-platform CLI csv pretty printer that uses column styling to maximize viewer enjoyment
run zinit for @uzimaru0000/tv; assert $state equals 0
local tv="$ZBIN/tv"; assert "$tv" is_executable
run $tv --version; assert $state equals 0
}
@test 'up' { # Deploy infinitely scalable serverless apps, apis, and sites in seconds to AWS
run zinit lbin'!up* -> up' for akavel/up; assert $state equals 0
local up="$ZBIN/up"; assert "$up" is_executable
Expand Down Expand Up @@ -845,7 +813,7 @@
run $yq --version; assert $state equals 0
}
@test 'zed' { # Tooling for super-structured data: a new and easier way to manipulate data
run zinit for @brimdata/zed; assert $state equals 0
run zinit for @brimdata/super; assert $state equals 0
local zed="$ZBIN/zed"; assert "$zed" is_executable
run $zed --version; assert $state equals 0
}
Expand Down
6 changes: 3 additions & 3 deletions tests/snippets.zunit
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@
setup_snippet_ok $state $output "$ZINIT[COMPLETIONS_DIR]"/_fd
}
@test 'tldr-completion::snippet' {
run install_completion 'tldr-completion/_tldr' 'dbrgn/tealdeer/main/completion/zsh_tealdeer'
run install_completion 'tldr-completion/_tldr' 'tealdeer-rs/tealdeer/main/completion/zsh_tealdeer'
setup_snippet_ok $state $output "$ZINIT[COMPLETIONS_DIR]"/_tldr
zinit delete --yes tldr-completion/_tldr; zinit cclear
}
@test 'tldr-completion::gh-r' {
artifact="$ZINIT[PLUGINS_DIR]/tldr-completion---gh-r"
run zinit for as"completion" from"gh-r" id-as'tldr-completion/gh-r' bpick"completions_zsh" mv"completions_zsh -> _tldr_ghr" pick"_tldr_ghr" @dbrgn/tealdeer
run zinit for as"completion" from"gh-r" id-as'tldr-completion/gh-r' bpick"completions_zsh" mv"completions_zsh -> _tldr_ghr" pick"_tldr_ghr" @tealdeer-rs/tealdeer
assert $state equals 0
assert "$artifact/_tldr_ghr" is_file
assert $artifact/_tldr_ghr is_readable
Expand All @@ -65,7 +65,7 @@
cat<<EOF >$actual
alias foo=date
EOF
run zinit is-snippet link id-as'mysnippet' for $actual
run zinit is-snippet link nocompile id-as'mysnippet' for $actual

assert $state equals 0
assert "$output" contains "Setting up snippet"
Expand Down

0 comments on commit 50643c6

Please sign in to comment.