Skip to content

Commit

Permalink
Merge pull request #1 from davvid/shellcheck
Browse files Browse the repository at this point in the history
* davvid/shellcheck:
  garden: add "publish" push URLs
  ci: use github actions to run checks
  garden: add "garden check" for running gcd.sh through shellcheck
  • Loading branch information
davvid committed Feb 16, 2024
2 parents 8170806 + fd2a862 commit 0ff29ef
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI

on: [push, pull_request]

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
run: rustup toolchain install stable --profile minimal --no-self-update
- name: Install Garden
run: cargo install garden-tools
- uses: Swatinem/rust-cache@v2
- name: Install Dependencies
run: |
set -x
sudo apt-get update
# Runtime dependencies (required)
sudo apt-get install shellcheck
- name: Run tests and checks
run: garden -vv check
18 changes: 18 additions & 0 deletions garden.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Use "cargo install garden-tools" to install garden (https://gitlab.com/garden-rs/garden).
# Usage:
# garden check
commands:
check: shellcheck --exclude=SC2148 gcd.sh
setup: sudo apt install shellcheck

trees:
gcd:
description: Git worktree navigator
path: "${GARDEN_CONFIG_DIR}"
url: "[email protected]:davvid/gcd.git"
remotes:
github: "[email protected]:davvid/gcd.git"
gitconfig:
remote.publish.pushurl:
- "[email protected]:davvid/gcd.git"
- "[email protected]:davvid/gcd.git"
3 changes: 2 additions & 1 deletion gcd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gcd () {
)
if test -n "${__gcd_worktree}"
then
cd "${__gcd_worktree}"
cd "${__gcd_worktree}" || exit 1
fi
}

Expand Down Expand Up @@ -61,6 +61,7 @@ __gcd_worktrees () {
fi
if test -n "${fdfind_cmd}"
then
# shellcheck disable=SC2086
"${fdfind_cmd}" ${fdfind_args} '^\.git$' "$@" | xargs -P 4 -n 1 dirname 2>/dev/null
else
find -L "$@" -maxdepth ${gcd_depth} -name .git -printf '%h\n' 2>/dev/null
Expand Down

0 comments on commit 0ff29ef

Please sign in to comment.