Skip to content

Commit

Permalink
build: add lint and test just recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
imiric committed Apr 21, 2024
1 parent df4c1b0 commit 3c396cd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
.env
/disco
/dist
/*.txt
*.log
32 changes: 29 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
version := "1"

# Shell script recipes fail if /tmp is mounted with noexec, so change the
# tempdir. See https://github.com/casey/just/issues/1611
set tempdir := "."


default:
just --list

version := "1"

build *ARGS:
./release/build.sh "{{ARGS}}"
./release/build.sh '{{ARGS}}'


clean:
rm -rf ./dist
rm -rf ./dist ./golangci-lint*.txt


lint report="":
#!/usr/bin/env sh
if [ -z '{{report}}' ]; then
golangci-lint run --out-format=tab --new-from-rev=e72df147cd ./...
exit $?
fi
_report_id="$(date '+%Y%m%d')-$(git describe --tags --abbrev=10 --always)"
golangci-lint run --out-format=tab --issues-exit-code=0 ./... | \
tee "golangci-lint-${_report_id}.txt" | \
awk 'NF {if ($2 == "revive") print $2 ":" $3; else print $2}' \
| sort | uniq -c | sort -nr \
| tee "golangci-lint-summary-${_report_id}.txt"


test target="..." *ARGS="":
go test -v -race -count=1 -failfast {{ARGS}} ./{{target}}

0 comments on commit 3c396cd

Please sign in to comment.