From d4bbfaa9f6e2d780bd9b49d9f460fd6a8305e498 Mon Sep 17 00:00:00 2001 From: Vit Listik Date: Sat, 23 Oct 2021 16:18:23 +0200 Subject: [PATCH 1/2] added test pipelines --- .github/workflows/go.yaml | 22 ++++++++++++++++++++++ .github/workflows/sh.yaml | 17 +++++++++++++++++ Makefile | 3 ++- README.md | 2 ++ go.mod | 2 +- 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/go.yaml create mode 100644 .github/workflows/sh.yaml diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml new file mode 100644 index 0000000..07deb74 --- /dev/null +++ b/.github/workflows/go.yaml @@ -0,0 +1,22 @@ +name: Go +on: [push] +jobs: + + test: + name: Test + runs-on: ubuntu-latest + steps: + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Test + run: go test -v ./... + + - name: Vet + run: go vet ./... diff --git a/.github/workflows/sh.yaml b/.github/workflows/sh.yaml new file mode 100644 index 0000000..fdd34f5 --- /dev/null +++ b/.github/workflows/sh.yaml @@ -0,0 +1,17 @@ +name: Shell +on: [push] +jobs: + + test: + name: Test + runs-on: ubuntu-latest + steps: + + - name: Set up + run: sudo apt-get install -y shellcheck zsh + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Test + run: scripts/test.sh diff --git a/Makefile b/Makefile index c3ad5d8..ae1e8d9 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ test_go: @for dir in {cmd,pkg}/* ; do \ echo $$dir ; \ go test $$dir/*.go ; \ + go vet $$dir/*.go ; \ done test: test_go @@ -26,7 +27,7 @@ rebuild: make build clean: - rm bin/resh-* + rm -f bin/resh-* uninstall: # Uninstalling ... diff --git a/README.md b/README.md index 0ac7c42..157598a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ ![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/curusarn/resh?sort=semver) +![Go test](https://github.com/curusarn/resh/actions/workflows/go.yaml/badge.svg) +![Shell test](https://github.com/curusarn/resh/actions/workflows/sh.yaml/badge.svg) # Rich Enhanced Shell History diff --git a/go.mod b/go.mod index b5fb37b..2cf0e94 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/curusarn/resh -go 1.12 +go 1.16 require ( github.com/BurntSushi/toml v0.3.1 From 36c275afe02316b52b1c71f63e8507cf9625bf0a Mon Sep 17 00:00:00 2001 From: Vit Listik Date: Sat, 23 Oct 2021 22:33:05 +0200 Subject: [PATCH 2/2] fixed shell lint - escape array --- scripts/reshctl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/reshctl.sh b/scripts/reshctl.sh index 6a5f9df..8544ce0 100644 --- a/scripts/reshctl.sh +++ b/scripts/reshctl.sh @@ -109,7 +109,7 @@ __resh_unbind_all() { resh() { local buffer local git_remote; git_remote="$(git remote get-url origin 2>/dev/null)" - buffer=$(resh-cli --sessionID "$__RESH_SESSION_ID" --host "$__RESH_HOST" --pwd "$PWD" --gitOriginRemote "$git_remote" $@) + buffer=$(resh-cli --sessionID "$__RESH_SESSION_ID" --host "$__RESH_HOST" --pwd "$PWD" --gitOriginRemote "$git_remote" "$@") status_code=$? if [ $status_code = 111 ]; then # execute