Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: test on different versions of zsh #416

Merged
merged 3 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions .github/workflows/ci.yaml → .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ci
name: test on linux

on:
push:
Expand All @@ -10,29 +10,25 @@ on:

jobs:
test:
name: run test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
steps:
- name: checkout
uses: actions/checkout@v1
with:
fetch-depth: 1

- name: install zsh (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install zsh
- name: install zsh
run: sudo apt-get install -y zsh

- name: test completion (ubuntu)
if: matrix.os == 'ubuntu-latest'
- name: test completion
run: cd test && zsh -f runtests.zsh fzftab.ztst

- name: build binary module
run: zsh -fc 'source ./fzf-tab.zsh && build-fzf-tab-module'

- name: test binary module (ubuntu)
if: matrix.os == 'ubuntu-latest'
- name: test binary module
run: cd test && zsh -f runtests.zsh fzftab.ztst

28 changes: 28 additions & 0 deletions .github/workflows/macos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: test on macOS

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
runs-on: macos-latest
steps:
- name: checkout
uses: actions/checkout@v1
with:
fetch-depth: 1

# FIXME: test on macOS
#- name: test completion
# run: cd test && zsh -f runtests.zsh fzftab.ztst

- name: build binary module
run: zsh -fc 'source ./fzf-tab.zsh && build-fzf-tab-module'

#- name: test binary module
# run: cd test && zsh -f runtests.zsh fzftab.ztst
45 changes: 45 additions & 0 deletions .github/workflows/zsh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: test on different zsh versions

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# TODO: test fzf version?
zsh_version:
- 5.3.1
- 5.4.2
- 5.5.1
- 5.6.2
- 5.7.1
- 5.8
- 5.9
container:
image: zshusers/zsh:${{ matrix.zsh_version }}
steps:
- name: checkout
uses: actions/checkout@v1
with:
fetch-depth: 1

- name: install dependencies
run: apt update && apt-get install -y git build-essential autoconf libncurses-dev

- name: test completion
run: cd test && zsh -f runtests.zsh fzftab.ztst

- name: build binary module
run: zsh -fc 'source ./fzf-tab.zsh && build-fzf-tab-module'

- name: test binary module
run: cd test && zsh -f runtests.zsh fzftab.ztst

1 change: 1 addition & 0 deletions fzf-tab.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ build-fzf-tab-module() {
print -P "%F{green}%BThe module has been built successfully. Please restart zsh to apply it.%f%b"
else
print -P -u2 "%F{red}%BThe module building has failed. See the output above for details.%f%b"
return 1
fi
} always {
popd -q
Expand Down
20 changes: 8 additions & 12 deletions lib/-ftb-build-module
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
#!/hint/zsh
emulate -LR zsh -o extended_glob -o err_exit
emulate -LR zsh -o extended_glob -o err_return

local zsh_version=${1:-${FZF_TAB_ZSH_SRC_VERSION:-$ZSH_VERSION}}

# macos check
local ret bundle nproc
if [[ $OSTYPE == darwin* ]]; then
[[ $OSTYPE == darwin* ]] && {
[[ -n ${module_path[1]}/**/*.bundle(#qN) ]] && bundle=true
nproc=$(sysctl -n hw.logicalcpu)
else
} || {
nproc=$(nproc)
fi
}

# clone zsh source code if not exists
if [[ ! -d ./zsh/$zsh_version ]]; then
[[ -d ./zsh/$zsh_version ]] || {
git clone --depth=1 --branch zsh-$zsh_version https://github.com/zsh-users/zsh ./zsh/$zsh_version
ln -s $PWD/src/fzftab.c ./zsh/$zsh_version/Src/Modules/
ln -s $PWD/src/fzftab.mdd ./zsh/$zsh_version/Src/Modules/
fi
}

# build zsh
cd -q ./zsh/$zsh_version
if [[ ! -f ./configure ]]; then
./Util/preconfig
fi
if [[ ! -f ./Makefile ]]; then
./configure --disable-gdbm --disable-pcre --without-tcsetpgrp --prefix=/tmp/zsh-fzf-tab-module ${bundle:+DL_EXT=bundle}
fi
[[ -f ./configure ]] || ./Util/preconfig
[[ -f ./Makefile ]] || ./configure --disable-gdbm --disable-pcre --without-tcsetpgrp --prefix=/tmp/zsh-fzf-tab-module ${bundle:+DL_EXT=bundle}
make -j$nproc

# we only need aloxaf/fzftab.so
Expand Down