Skip to content

Commit

Permalink
refactor: make, cmake, and configure ices
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Doster <[email protected]>
  • Loading branch information
vladdoster committed Dec 10, 2023
1 parent 0ba778a commit 94166fd
Show file tree
Hide file tree
Showing 10 changed files with 521 additions and 459 deletions.
42 changes: 27 additions & 15 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["macos-latest", "ubuntu-latest"]
os: ["macos-latest","ubuntu-latest"]
fail-fast: false

steps:
Expand All @@ -39,15 +39,30 @@ jobs:
id: setup-homebrew
uses: Homebrew/actions/setup-homebrew@master

# - name: "install musl"
# if: runner.os == 'Linux'
# run: sudo apt-get install build-essential curl file gcc gcc-multilib glibc-source libc6 libc6-dev unzip xz-utils zsh
- name: "install musl"
if: runner.os == 'Linux'
run: |
sudo apt-get update --yes
sudo apt-get install --yes \
autoconf automake autotools-dev \
build-essential byacc\
cmake curl \
file \
gcc gettext glibc-source grep \
libc6 libc6-dev libevent-dev libncurses5-dev libncursesw5-dev libtool libuvc0 lua5.1 \
m4 \
ninja-build \
pkg-config \
unzip \
xz-utils \
zsh
- name: "install dependencies"
id: install-deps
run: |
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
brew install --force --overwrite gnu-sed coreutils unzip xz zsh
brew install --force --overwrite autoconf automake binutils byacc cmake coreutils curl gettext gnu-sed libevent libtool libuv lua [email protected] make ninja ncurses pkg-config texinfo unzip xz zsh
brew link --force --overwrite ncurses
- name: "install zunit"
id: install-zunit
Expand All @@ -56,23 +71,20 @@ jobs:
git clone --depth 1 https://github.com/zdharma-continuum/zunit; cd ./zunit
zsh -c -l './build.zsh' && sudo chmod u+x ./zunit && cp ./zunit "$HOME/.local/bin/"
# - name: disable secssessment system policy security
# run: sudo spctl --master-disable

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

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

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

- name: "gh-r"
run: zunit run --fail-fast --verbose tests/gh-r.zunit
run: zunit run tests/gh-r.zunit

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

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

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

- name: "snippets"
run: zunit run tests/snippets.zunit
4 changes: 2 additions & 2 deletions .zunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ directories:
output: tests/_output
support: tests/_support
tests: tests
fail_fast: false
verbose: false
fail_fast: true
verbose: true
45 changes: 20 additions & 25 deletions README.md

Large diffs are not rendered by default.

49 changes: 30 additions & 19 deletions tests/_support/bootstrap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env zsh
setopt NO_GLOBAL_RCS NO_GLOBAL_EXPORT NO_RCS
setopt NO_GLOBAL_RCS NO_GLOBAL_EXPORT NO_RCS NO_ALIASES

# Log functions [[[
function error(){ print -P "%F{red}[ERROR]%f: ${1}" && return 1; }
Expand All @@ -19,14 +19,19 @@ if [[ ! -d ${TMP_ZUNIT} ]]; then
exit 1
fi

typeset -gAH ZINIT;
ZINIT[HOME_DIR]=${TMP_ZUNIT};
ZINIT[BIN_DIR]=$ZINIT[HOME_DIR]/zinit.git;
ZINIT[COMPLETIONS_DIR]=$ZINIT[HOME_DIR]/completions;
ZINIT[PLUGINS_DIR]=$ZINIT[HOME_DIR]/plugins;
ZINIT[SNIPPETS_DIR]=$ZINIT[HOME_DIR]/snippets;
ZINIT[ZCOMPDUMP_PATH]=$ZINIT[HOME_DIR]/zcompdump;
ZPFX=$ZINIT[HOME_DIR]/polaris;
typeset -g zi_dir="${TMP_ZUNIT}"
typeset -gxUA ZINIT
# DEBUG 'true'
ZINIT+=(
BIN_DIR ${zi_dir}/zinit.git
COMPLETIONS_DIR ${zi_dir}/completions SNIPPETS_DIR ${zi_dir}/snippets
HOME_DIR ${zi_dir} PLUGINS_DIR ${zi_dir}/plugins
ZCOMPDUMP_PATH ${zi_dir}/zcompdump ZPFX ${zi_dir}/polaris
POLARIS ${zi_dir}/polaris
)
typeset -gxH ZPFX="$ZINIT[POLARIS]"
# FORK 'vladdoster' REPO 'zinit-t'
# typeset -gxAUH ZINIT=(${(kv)CONFIG})

command git diff > ${ZINIT[HOME_DIR]}/unstaged.diff
info 'creating test env'
Expand All @@ -51,18 +56,24 @@ if [[ -s $ZINIT[HOME_DIR]/unstaged.diff ]]; then
fi
(( $? != 0 )) && { error "Unable to copy ${GIT_REPO} to ${TMP_ZUNIT}" >&2; exit 1 }

source $ZINIT[BIN_DIR]/zinit.zsh
(( $? != 0 )) && { error "Unable to copy ${GIT_REPO} to ${TMP_ZUNIT}" >&2; exit 1 }
hash -f
builtin hash -d zinit=$zi_dir
builtin hash -d zpfx=$zi_dir/polaris
source $zi_dir/zinit.git/zinit.zsh
(( $? != 0 )) && { error "Unable to source zinit" >&2; exit 1 }
hash -f
builtin hash -d zinit=$zi_dir
builtin hash -d zpfx=$zi_dir/polaris

# ]]]
# Install Annexes [[[
info 'installing test dependencies'
for annex (binary-symlink default-ice); do
if [[ ! -d ${GIT_REPO}/tests/_support/$annex ]]; then;
git clone https://github.com/zdharma-continuum/zinit-annex-$annex ${GIT_REPO:A}/tests/_support/$annex
fi
zinit light ${GIT_REPO:A}/tests/_support/$annex
info "loaded $annex dependencies"
done
+zi-log '{m} installing test dependencies'
zinit ver'feat/logging' for load @zdharma-continuum/zinit-annex-binary-symlink
+zi-log "{m} loaded $annex dependencies"
# ]]]

+zi-log '{nl}{bar}'
zinit zstatus
+zi-log '{bar}{nl}'

# vim:ft=zsh:sw=2:sts=2:et:foldmarker=[[[,]]]:foldmethod=marker
44 changes: 29 additions & 15 deletions tests/commands.zunit
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,13 @@
ZBIN="${ZPFX}/bin"
}

@test 'delete --help' {
run zinit delete --help
assert $output contains 'zinit delete [options] [plugins...]'
assert $state equals 0
}
@test 'delete --all' {
run zinit as'completion' is-snippet for @'https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker'
assert $state equals 0
}
@test 'delete a snippet' {
run zinit id-as'git.zsh' is-snippet for @'OMZL::git.zsh'
run zinit delete --yes 'git.zsh'
@test 'delete --help' {
run zinit delete --help
assert $output contains 'zinit delete [options] [plugins...]'
assert $state equals 0
}
@test 'delete a plugin' {
Expand All @@ -35,12 +30,9 @@
run zinit delete --yes mfaerevaag/wd
assert $state equals 0
}

@test 'plugins' {
run zinit plugins
assert $output contains 'Plugins'
assert $output contains 'Unloaded: '
assert $output contains 'Loaded: '
@test 'delete a snippet' {
run zinit id-as'git.zsh' is-snippet for @'OMZL::git.zsh'
run zinit delete --yes 'git.zsh'
assert $state equals 0
}
@test 'help' {
Expand All @@ -51,12 +43,34 @@
done
run zinit -help
assert $output contains 'Unknown subcommand'
assert $state equals 1
assert $state equals 1
}

@test 'plugins' {
run zinit plugins
assert $output contains 'Plugins'
assert $output contains 'Unloaded: '
assert $output contains 'Loaded: '
assert $state equals 0
}
@test 'self-update' {
run zinit self-update
assert $output contains 'Already up-to-date.'
assert $state equals 0
}
@test 'log_debug_unset' {
run eval '(( ${+ZINIT[DEBUG]} == 1 ))'; assert $state equals 1
run +zi-log -n "{dbg} message"
assert "$output" contains ""; assert $state equals 0
run +zi-log -n "{m} message"
assert "$output" contains "${ZINIT[col-m]} message"; assert $state equals 0
}
@test 'log_debug_set' {
ZINIT+=( DEBUG "true" )
run eval '(( ${+ZINIT[DEBUG]} == 1 ))'
assert $state equals 0
run +zi-log -n "{dbg} message"
assert $output contains "${ZINIT[col-dbg]} message"; assert $state equals 0
}

# vim:ft=zsh:sw=2:sts=2:et:foldmarker={,}:foldmethod=marker
Loading

0 comments on commit 94166fd

Please sign in to comment.