-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into #24-switch-to-mautrix
- Loading branch information
Showing
22 changed files
with
777 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
layout_poetry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "tests/semgrep-rules"] | ||
path = tests/semgrep-rules | ||
url = https://github.com/returntocorp/semgrep-rules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
builds: | ||
- id: pushbits | ||
main: ./cmd/pushbits | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- 386 | ||
- arm | ||
- arm64 | ||
|
||
checksum: | ||
algorithm: sha256 | ||
|
||
archives: | ||
- id: pushbits | ||
builds: | ||
- pushbits | ||
format: tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,45 @@ | ||
# References: | ||
# [1] Needed so the Go files of semgrep-rules do not interfere with static analysis | ||
|
||
DOCS_DIR := ./docs | ||
OUT_DIR := ./out | ||
TESTS_DIR := ./tests | ||
|
||
SEMGREP_MODFILE := $(TESTS_DIR)/semgrep-rules/go.mod | ||
|
||
.PHONY: build | ||
build: | ||
mkdir -p ./out | ||
go build -ldflags="-w -s" -o ./out/pushbits ./cmd/pushbits | ||
mkdir -p $(OUT_DIR) | ||
go build -ldflags="-w -s" -o $(OUT_DIR)/pushbits ./cmd/pushbits | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf $(DOCS_DIR) | ||
rm -rf $(OUT_DIR) | ||
rm -rf $(SEMGREP_MODFILE) | ||
|
||
.PHONY: test | ||
test: | ||
stdout=$$(gofmt -l . 2>&1); if [ "$$stdout" ]; then exit 1; fi | ||
touch $(SEMGREP_MODFILE) # See [1]. | ||
go fmt ./... | ||
go vet ./... | ||
gocyclo -over 10 $(shell find . -iname '*.go' -type f) | ||
gocyclo -over 10 $(shell find . -type f \( -iname '*.go' ! -path "./tests/semgrep-rules/*" \)) | ||
staticcheck ./... | ||
go test -v -cover ./... | ||
gosec -exclude-dir=tests ./... | ||
semgrep --lang=go --config=tests/semgrep-rules/go --metrics=off | ||
rm -rf $(SEMGREP_MODFILE) # See [1]. | ||
@printf '\n%s\n' "> Test successful" | ||
|
||
.PHONY: setup | ||
setup: | ||
git submodule update --init --recursive | ||
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest | ||
go install github.com/securego/gosec/v2/cmd/gosec@latest | ||
go install github.com/swaggo/swag/cmd/swag@latest | ||
go install honnef.co/go/tools/cmd/staticcheck@latest | ||
poetry install | ||
|
||
.PHONY: swag | ||
swag: | ||
swag init --parseDependency=true -d . -g cmd/pushbits/main.go | ||
swag init --parseDependency=true --exclude $(TESTS_DIR) -g cmd/pushbits/main.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.