mirror of
https://github.com/zplug/zplug
synced 2025-04-30 13:17:57 +02:00
Merge 26216225a5e0f6887173d28e3d9d1a17fa49123f into ac6c2a3e9eea6a488d96d98c752ef887e7d5aae3
This commit is contained in:
commit
378711b6fe
37
.github/workflows/tests.yml
vendored
Normal file
37
.github/workflows/tests.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
name: CI
|
||||
|
||||
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||
# events but only for the master branch
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- workflow-tests
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- workflow-tests
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
run-tests:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: macos-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Check zsh version
|
||||
run: |
|
||||
echo $ZSH_VERSION
|
||||
shell: zsh {0}
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
make shove
|
||||
make test
|
||||
shell: zsh {0}
|
@ -6,7 +6,7 @@ __zplug::core::add::to_zplugs()
|
||||
local -a re_tags
|
||||
|
||||
# DEPRECATED: pipe
|
||||
if [[ -p /dev/stdin ]]; then
|
||||
if [[ -p /dev/stdin && -z "${CI}" ]]; then
|
||||
__zplug::core::migration::pipe
|
||||
return $status
|
||||
fi
|
||||
|
@ -96,7 +96,7 @@ __zplug::job::parallel::init()
|
||||
# Suppress outputs
|
||||
setopt nonotify nomonitor
|
||||
# Hide the cursor
|
||||
tput civis
|
||||
__zplug::utils::shell::is_atty && tput civis
|
||||
|
||||
__zplug::io::print::f \
|
||||
--zplug \
|
||||
@ -174,5 +174,5 @@ __zplug::job::parallel::deinit()
|
||||
esac
|
||||
|
||||
# Display the cursor
|
||||
tput cnorm
|
||||
__zplug::utils::shell::is_atty && tput cnorm
|
||||
}
|
||||
|
@ -11,7 +11,8 @@ __zplug::job::rollback::build()
|
||||
return 1
|
||||
fi
|
||||
|
||||
tput civis
|
||||
__zplug::utils::shell::is_atty && tput civis
|
||||
|
||||
while read repo
|
||||
do
|
||||
if [[ -z $repo ]]; then
|
||||
@ -36,7 +37,8 @@ __zplug::job::rollback::build()
|
||||
"$repo"
|
||||
fi
|
||||
done <"$_zplug_build_log[rollback]"
|
||||
tput cnorm
|
||||
|
||||
__zplug::utils::shell::is_atty && tput cnorm
|
||||
|
||||
# Overwrite
|
||||
if (( $#failed == 0 )); then
|
||||
|
71
misc/zshrc
71
misc/zshrc
@ -5,13 +5,52 @@
|
||||
tests=()
|
||||
export ZPLUG_HOME="/tmp/zplug-$RANDOM"
|
||||
export ZPLUG_REPOS="$ZPLUG_HOME/repos"
|
||||
mkdir -p "$ZPLUG_HOME" "$ZPLUG_REPOS"
|
||||
export ZPLUG_BIN="$ZPLUG_HOME/bin"
|
||||
mkdir -p "$ZPLUG_HOME" "$ZPLUG_REPOS" "$ZPLUG_BIN"
|
||||
|
||||
# Prepare
|
||||
source "$ZPLUG_ROOT/init.zsh"
|
||||
zplugs=()
|
||||
zplug clear
|
||||
|
||||
# Output location. Default is standart output.
|
||||
# In CI env equals to /dev/null.
|
||||
_rd=/dev/stdout
|
||||
|
||||
_zplug_fin()
|
||||
{
|
||||
local _cmd="$1"
|
||||
__zplug::io::print::f \
|
||||
--zplug "${fg[green]}'${_cmd}' finished successfully.${reset_color}\n"
|
||||
}
|
||||
|
||||
_zplug_fail()
|
||||
{
|
||||
local _cmd="$1"
|
||||
__zplug::io::print::f \
|
||||
--zplug \
|
||||
--warn \
|
||||
"'${_cmd}' finished with errors.\n"
|
||||
}
|
||||
|
||||
_zplug_ci() {
|
||||
__zplug::io::print::f \
|
||||
--zplug \
|
||||
"${fg[yellow]}CI environment detected, output supressed.${reset_color}\n"
|
||||
}
|
||||
|
||||
_zplug_compinit_emu() {
|
||||
if ! compinit >/dev/null 2>&1; then
|
||||
function compinit() {
|
||||
return 0
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ -n "${CI}" ]]; then
|
||||
_rd=/dev/null && _zplug_ci
|
||||
fi
|
||||
|
||||
# as
|
||||
{
|
||||
# plugin
|
||||
@ -94,9 +133,9 @@ zplug clear
|
||||
'(( $+aliases[gbS] ))' # "prezto" modules/git
|
||||
'(( $+functions[git-dir] ))' # "prezto" modules/git
|
||||
'[[ -o autocd ]]' # "prezto" modules/directory
|
||||
'[[ -x $ZPLUG_HOME/bin/f ]]'
|
||||
'[[ ! -x $ZPLUG_HOME/bin/peco ]]' # for b4b4r07/zsh-gomi (on tag)
|
||||
'[[ -x $ZPLUG_HOME/bin/get_last_pane_path.sh ]]'
|
||||
'[[ -x $ZPLUG_HOME/bin/f ]]'
|
||||
)
|
||||
}
|
||||
|
||||
@ -220,14 +259,33 @@ zplug clear
|
||||
|
||||
tests+=(
|
||||
'[[ -x $ZPLUG_HOME/bin/http_code ]]'
|
||||
'[[ -x $ZPLUG_HOME/bin/pt ]]'
|
||||
'[[ ! -x $ZPLUG_HOME/bin/fzf ]]'
|
||||
'[[ -x $ZPLUG_HOME/bin/fzf-tmux ]]'
|
||||
'[[ -x $ZPLUG_HOME/bin/pt ]]'
|
||||
)
|
||||
}
|
||||
|
||||
zplug install || ret=1
|
||||
zplug load --verbose || ret=1
|
||||
ret=0
|
||||
|
||||
# 'autoload -U compinit' and 'compinit' fails on CI
|
||||
# due to non-interactive shell
|
||||
if [[ -n "${CI}" ]]; then
|
||||
_zplug_compinit_emu
|
||||
fi
|
||||
|
||||
if zplug install >${_rd} | grep -iq 'finished successfully'; then
|
||||
_zplug_fin 'install'
|
||||
else
|
||||
_zplug_fail 'install'
|
||||
ret=1
|
||||
fi
|
||||
|
||||
if zplug load --verbose >${_rd}; then
|
||||
_zplug_fin 'load'
|
||||
else
|
||||
_zplug_fail 'load'
|
||||
ret=1
|
||||
fi
|
||||
|
||||
# on (test case)
|
||||
|
||||
@ -254,12 +312,11 @@ zplug load --verbose || ret=1
|
||||
# )
|
||||
#}
|
||||
|
||||
ret=0
|
||||
for test in "$tests[@]"
|
||||
do
|
||||
eval "$test"
|
||||
if (( $status != 0 )); then
|
||||
printf "$fg[red]FAIL: $test$reset_color\n" >&2
|
||||
_zplug_fail "${test}"
|
||||
ret=1
|
||||
fi
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user