From 9cad625197d49b88ac3ef13ec5d06e742d5b3c34 Mon Sep 17 00:00:00 2001 From: Aloxaf Date: Sun, 25 Feb 2024 18:56:28 +0800 Subject: [PATCH] ci: test different version of zsh --- .github/workflows/{ci.yaml => linux.yaml} | 16 +++----- .github/workflows/macos.yaml | 28 ++++++++++++++ .github/workflows/zsh.yaml | 45 +++++++++++++++++++++++ fzf-tab.zsh | 1 + lib/-ftb-build-module | 2 +- test/fzftab.ztst | 1 + 6 files changed, 82 insertions(+), 11 deletions(-) rename .github/workflows/{ci.yaml => linux.yaml} (58%) create mode 100644 .github/workflows/macos.yaml create mode 100644 .github/workflows/zsh.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/linux.yaml similarity index 58% rename from .github/workflows/ci.yaml rename to .github/workflows/linux.yaml index ae72c58..b6309f2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/linux.yaml @@ -1,4 +1,4 @@ -name: ci +name: test on linux on: push: @@ -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 diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml new file mode 100644 index 0000000..f76b8d4 --- /dev/null +++ b/.github/workflows/macos.yaml @@ -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 diff --git a/.github/workflows/zsh.yaml b/.github/workflows/zsh.yaml new file mode 100644 index 0000000..312bf06 --- /dev/null +++ b/.github/workflows/zsh.yaml @@ -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 + + - 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 + diff --git a/fzf-tab.zsh b/fzf-tab.zsh index 2eb4bc2..0761058 100644 --- a/fzf-tab.zsh +++ b/fzf-tab.zsh @@ -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 diff --git a/lib/-ftb-build-module b/lib/-ftb-build-module index 6f9f77e..9b62308 100644 --- a/lib/-ftb-build-module +++ b/lib/-ftb-build-module @@ -1,5 +1,5 @@ #!/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}} diff --git a/test/fzftab.ztst b/test/fzftab.ztst index 98028f3..aa66dce 100644 --- a/test/fzftab.ztst +++ b/test/fzftab.ztst @@ -25,6 +25,7 @@ touch file1 && touch file2 touch dir1/file1 + # TODO: remove git from tests git init } else