Skip to content

Commit 3e44d72

Browse files
Update Managed Files (#2)
* Update dep-review * Update go-makefile * Update dependabot * Update go-test
1 parent dce571e commit 3e44d72

File tree

4 files changed

+209
-0
lines changed

4 files changed

+209
-0
lines changed

.github/dependabot.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# This file is managed by the repo-content-updater project. Manual changes here will result in a PR to bring back
2+
# inline with the upstream template, unless you remove the dependabot managed file property from the repo
3+
4+
version: 2
5+
updates:
6+
- package-ecosystem: "gomod"
7+
directory: /
8+
schedule:
9+
interval: "weekly"
10+
day: "tuesday"
11+
open-pull-requests-limit: 10
12+
labels:
13+
- dependencies
14+
- go
15+
- "Changed"
16+
reviewers: ["cmmarslender", "starttoaster"]
17+
groups:
18+
global:
19+
patterns:
20+
- "*"
21+
22+
- package-ecosystem: "pip"
23+
directory: /
24+
schedule:
25+
interval: "weekly"
26+
day: "tuesday"
27+
open-pull-requests-limit: 10
28+
labels:
29+
- dependencies
30+
- python
31+
- "Changed"
32+
reviewers: ["emlowe", "altendky"]
33+
34+
- package-ecosystem: "github-actions"
35+
directory: /
36+
schedule:
37+
interval: "weekly"
38+
day: "tuesday"
39+
open-pull-requests-limit: 10
40+
labels:
41+
- dependencies
42+
- github_actions
43+
- "Changed"
44+
reviewers: ["cmmarslender", "Starttoaster", "pmaslana"]
45+
46+
- package-ecosystem: "npm"
47+
directory: /
48+
schedule:
49+
interval: "weekly"
50+
day: "tuesday"
51+
open-pull-requests-limit: 10
52+
labels:
53+
- dependencies
54+
- javascript
55+
- "Changed"
56+
reviewers: ["cmmarslender", "ChiaMineJP"]
57+
58+
- package-ecosystem: cargo
59+
directory: /
60+
schedule:
61+
interval: "weekly"
62+
day: "tuesday"
63+
open-pull-requests-limit: 10
64+
labels:
65+
- dependencies
66+
- rust
67+
- "Changed"
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Managed by repo-content-updater
2+
# Dependency Review Action
3+
#
4+
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
5+
#
6+
# Source repository: https://github.com/actions/dependency-review-action
7+
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
8+
name: "🚨 Dependency Review"
9+
on: [pull_request]
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
dependency-review:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: "Checkout Repository"
19+
uses: actions/checkout@v4
20+
21+
- name: "Dependency Review"
22+
uses: actions/dependency-review-action@v4
23+
with:
24+
deny-licenses: AGPL-1.0-only, AGPL-1.0-or-later, AGPL-1.0-or-later, AGPL-3.0-or-later, GPL-1.0-only, GPL-1.0-or-later, GPL-2.0-only, GPL-2.0-or-later, GPL-3.0-only, GPL-3.0-or-later

.github/workflows/go-test.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Go Test
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
container: golang:1
12+
steps:
13+
- name: Mark git directory safe
14+
uses: Chia-Network/actions/git-mark-workspace-safe@main
15+
16+
- uses: actions/checkout@v4
17+
18+
- name: Test
19+
run: make test

Makefile

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
MODULE = $(shell env GO111MODULE=on $(GO) list -m)
2+
DATE ?= $(shell date +%FT%T%z)
3+
PKGS = $(or $(PKG),$(shell env GO111MODULE=on $(GO) list ./...))
4+
TESTPKGS = $(shell env GO111MODULE=on $(GO) list -f \
5+
'{{ if or .TestGoFiles .XTestGoFiles }}{{ .ImportPath }}{{ end }}' \
6+
$(PKGS))
7+
BIN = $(CURDIR)/bin
8+
9+
GO = go
10+
TIMEOUT = 15
11+
V = 0
12+
Q = $(if $(filter 1,$V),,@)
13+
M = $(shell printf "\033[34;1m▶\033[0m")
14+
15+
binext=""
16+
ifeq ($(GOOS),windows)
17+
binext=".exe"
18+
endif
19+
20+
export GO111MODULE=on
21+
22+
.PHONY: all
23+
all: fmt lint vet build
24+
25+
.PHONY: build
26+
build: $(BIN) ; $(info $(M) building executable…) @ ## Build program binary
27+
$Q CGO_ENABLED=0 $(GO) build \
28+
-ldflags "-X main.gitVersion=$$(git describe --tags) -X $(MODULE)/cmd.gitVersion=$$(git describe --tags) -X \"main.buildTime=$$(date -u '+%Y-%m-%d %H:%M:%S %Z')\" -X \"$(MODULE)/cmd.buildTime=$$(date -u '+%Y-%m-%d %H:%M:%S %Z')\"" \
29+
-tags release \
30+
-o $(BIN)/$(notdir $(basename $(MODULE)))$(binext)
31+
# Tools
32+
33+
$(BIN):
34+
@mkdir -p $@
35+
$(BIN)/%: | $(BIN) ; $(info $(M) building $(PACKAGE)…)
36+
$Q env GOBIN=$(BIN) $(GO) install $(PACKAGE) \
37+
|| ret=$$?; \
38+
exit $$ret
39+
40+
GOLINT = $(BIN)/golint
41+
$(BIN)/golint: PACKAGE=golang.org/x/lint/golint@latest
42+
43+
STATICCHECK = $(BIN)/staticcheck
44+
$(BIN)/staticcheck: PACKAGE=honnef.co/go/tools/cmd/staticcheck@latest
45+
46+
ERRCHECK = $(BIN)/errcheck
47+
$(BIN)/errcheck: PACKAGE=github.com/kisielk/errcheck@latest
48+
49+
VULNCHECK = $(BIN)/govulncheck
50+
$(BIN)/govulncheck: PACKAGE=golang.org/x/vuln/cmd/govulncheck@latest
51+
52+
# Tests
53+
54+
TEST_TARGETS := test-default test-bench test-short test-verbose test-race
55+
.PHONY: $(TEST_TARGETS) check test tests
56+
test-bench: ARGS=-run=__absolutelynothing__ -bench=. ## Run benchmarks
57+
test-short: ARGS=-short ## Run only short tests
58+
test-verbose: ARGS=-v ## Run tests in verbose mode
59+
test-race: ARGS=-race ## Run tests with race detector
60+
$(TEST_TARGETS): NAME=$(MAKECMDGOALS:test-%=%)
61+
$(TEST_TARGETS): test
62+
check test tests: fmt lint vet staticcheck errcheck vulncheck; $(info $(M) running $(NAME:%=% )tests…) @ ## Run tests
63+
$Q $(GO) test -timeout $(TIMEOUT)s $(ARGS) $(TESTPKGS)
64+
65+
.PHONY: lint
66+
lint: | $(GOLINT) ; $(info $(M) running golint…) @ ## Run golint
67+
$Q $(GOLINT) -set_exit_status $(PKGS)
68+
69+
.PHONY: fmt
70+
fmt: ; $(info $(M) running gofmt…) @ ## Run gofmt on all source files
71+
$Q $(GO) fmt $(PKGS)
72+
73+
.PHONY: vet
74+
vet: ; $(info $(M) running go vet…) @ ## Run go vet on all source files
75+
$Q $(GO) vet $(PKGS)
76+
77+
.PHONY: staticcheck
78+
staticcheck: | $(STATICCHECK) ; $(info $(M) running staticcheck…) @
79+
$Q $(STATICCHECK) $(PKGS)
80+
81+
.PHONY: errcheck
82+
errcheck: | $(ERRCHECK) ; $(info $(M) running errcheck…) @
83+
$Q $(ERRCHECK) $(PKGS)
84+
85+
.PHONY: vulncheck
86+
vulncheck: | $(VULNCHECK) ; $(info $(M) running vulncheck…) @
87+
$Q $(VULNCHECK) $(PKGS)
88+
89+
# Misc
90+
91+
.PHONY: clean
92+
clean: ; $(info $(M) cleaning…) @ ## Cleanup everything
93+
@rm -rf $(BIN)
94+
@rm -rf test/tests.*
95+
96+
.PHONY: help
97+
help:
98+
@grep -hE '^[ a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
99+
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-17s\033[0m %s\n", $$1, $$2}'

0 commit comments

Comments
 (0)