add check.sh scripts
This commit is contained in:
parent
c04bcb8831
commit
ea30737ae6
|
@ -120,6 +120,9 @@ prerequisite software:
|
|||
|
||||
### workflow
|
||||
|
||||
!!! note
|
||||
alternatively, run `check.sh` inside `src/surplus-on-wheels`
|
||||
|
||||
- formatting s+ow:
|
||||
- run `shfmt s+ow > s+ow.new`
|
||||
- mv `s+ow.new` into `s+ow`
|
||||
|
@ -161,10 +164,15 @@ poetry shell
|
|||
|
||||
after modifying,
|
||||
|
||||
1. `mypy bridge.py`
|
||||
2. `ruff format bridge.py`
|
||||
3. `ruff check bridge.py`
|
||||
4. [test the binary](#workflow-for-testing-the-binary)
|
||||
1. check the source code:
|
||||
1. `mypy bridge.py`
|
||||
2. `ruff format bridge.py`
|
||||
3. `ruff check bridge.py`
|
||||
|
||||
!!! note
|
||||
alternatively, run `check.sh` inside `src/spow-telegram-bridge`
|
||||
|
||||
2. and then [test the binary](#workflow-for-testing-the-binary)
|
||||
|
||||
if the bridge behaves nominally, [bump the version](#versioning-surplus-on-wheels-telegram-bridge)
|
||||
and commit!
|
||||
|
@ -194,9 +202,19 @@ code, and as such, whenever in doubt, do a diff between mdtest and the bridge co
|
|||
|
||||
after modifying,
|
||||
|
||||
1. [build a binary](#workflow-for-building-a-binary)
|
||||
2. [test the binary](#workflow-for-testing-the-binary)
|
||||
3. and if all goes well, [bump the version](#versioning-surplus-on-wheels-whatsapp-bridge)
|
||||
1. check the source code:
|
||||
1. `go fmt bridge.go`
|
||||
2. `go vet bridge.go`
|
||||
3. `golint bridge.go`
|
||||
|
||||
!!! note
|
||||
alternatively, run `check.sh` inside `src/spow-whatsapp-bridge`
|
||||
|
||||
2. [build a binary](#workflow-for-building-a-binary)
|
||||
|
||||
3. [test the binary](#workflow-for-testing-the-binary)
|
||||
|
||||
4. and if all goes well, [bump the version](#versioning-surplus-on-wheels-whatsapp-bridge)
|
||||
and commit!
|
||||
|
||||
### workflow for bumping dependencies
|
||||
|
@ -224,7 +242,7 @@ CGO_ENABLED=1 go build
|
|||
nix users can alternatively run:
|
||||
|
||||
```text
|
||||
nix build .#native
|
||||
nix build
|
||||
```
|
||||
|
||||
instructions to build a Termux build are located at the
|
||||
|
|
|
@ -37,15 +37,25 @@ https://github.com/markjoshwel/surplus.git
|
|||
## surplus on wheels: Telegram Bridge
|
||||
|
||||
- install/update script:
|
||||
|
||||
|
||||
``` title="Primary Link"
|
||||
https://surplus.joshwel.co/telegram.sh
|
||||
```
|
||||
|
||||
|
||||
``` title="Alternative Link"
|
||||
https://raw.githubusercontent.com/markjoshwel/surplus/main/src/spow-telegram-bridge/install.sh
|
||||
```
|
||||
|
||||
- pipx target
|
||||
|
||||
``` title="Primary Link"
|
||||
git+https://forge.joshwel.co/mark/surplus.git#egg=spow-telegram-bridge&subdirectory=src/spow-telegram-bridge
|
||||
```
|
||||
|
||||
``` title="Alternative Link"
|
||||
git+https://github.com/markjoshwel/surplus.git#egg=spow-telegram-bridge&subdirectory=src/spow-telegram-bridge
|
||||
```
|
||||
|
||||
## surplus on wheels: WhatsApp Bridge
|
||||
|
||||
- install/update script:
|
||||
|
|
21
src/spow-telegram-bridge/check.sh
Normal file
21
src/spow-telegram-bridge/check.sh
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
failures=0
|
||||
|
||||
mypy bridge.py
|
||||
failures=$((failures + $?))
|
||||
|
||||
ruff check bridge.py
|
||||
failures=$((failures + $?))
|
||||
|
||||
ruff format bridge.py
|
||||
failures=$((failures + $?))
|
||||
|
||||
isort --check bridge.py
|
||||
failures=$((failures + $?))
|
||||
|
||||
if [ $failures -eq 0 ]; then
|
||||
printf "\n\nall checks okay! (❁´◡\`❁)\n"
|
||||
else
|
||||
printf "\n\nsome checks failed...\n"
|
||||
fi
|
||||
exit $failures
|
24
src/spow-whatsapp-bridge/check.sh
Normal file
24
src/spow-whatsapp-bridge/check.sh
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
failures=0
|
||||
|
||||
ORI_HASH=$(md5sum < bridge.go)
|
||||
FMT_HASH=$(gofmt bridge.go | md5sum)
|
||||
if ! [ "$FMT_HASH" = "$ORI_HASH" ]; then
|
||||
printf "formatted file (%s) is not the same as the original file (%s)" "$FMT_HASH" "$ORI_HASH"
|
||||
failures=$((failures + 1))
|
||||
else
|
||||
printf "formatted file is same as original file - %s (yay!)" "$FMT_HASH"
|
||||
fi
|
||||
|
||||
go vet bridge.go
|
||||
failures=$((failures + $?))
|
||||
|
||||
golint bridge.go
|
||||
failures=$((failures + $?))
|
||||
|
||||
if [ $failures -eq 0 ]; then
|
||||
printf "\n\nall checks okay! (❁´◡\`❁)\n"
|
||||
else
|
||||
printf "\n\nsome checks failed...\n"
|
||||
fi
|
||||
exit $failures
|
21
src/surplus-on-wheels/check.sh
Normal file
21
src/surplus-on-wheels/check.sh
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
failures=0
|
||||
|
||||
FMT_HASH=$(shfmt s+ow | md5sum)
|
||||
ORI_HASH=$(md5sum < s+ow)
|
||||
if ! [ "$FMT_HASH" = "$ORI_HASH" ]; then
|
||||
printf "formatted file (%s) is not the same as the original file (%s)" "$FMT_HASH" "$ORI_HASH"
|
||||
failures=$((failures + 1))
|
||||
else
|
||||
printf "formatted file is same as original file - %s (yay!)" "$FMT_HASH"
|
||||
fi
|
||||
|
||||
shellcheck s+ow
|
||||
failures=$((failures + $?))
|
||||
|
||||
if [ $failures -eq 0 ]; then
|
||||
printf "\n\nall checks okay! (❁´◡\`❁)\n"
|
||||
else
|
||||
printf "\n\nsome checks failed...\n"
|
||||
fi
|
||||
exit $failures
|
Loading…
Reference in a new issue