Skip to content

Commit

Permalink
chore: fill out clean targets
Browse files Browse the repository at this point in the history
Signed-off-by: Keith Zantow <[email protected]>
  • Loading branch information
kzantow committed Oct 22, 2024
1 parent 64df994 commit 5d227ea
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ linters:
- dogsled
- dupl
- errcheck
- exportloopref
- funlen
- gocognit
- goconst
Expand Down Expand Up @@ -49,6 +48,7 @@ linters:
# do not enable...
# - bodyclose # 1.18 compat
# - depguard # we don't have a specific configuration for this
# - exportloopref # no longer relevant post go 1.22
# - gochecknoglobals
# - gochecknoinits # this is too aggressive
# - godot
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.PHONY: test
test:
@go run -C make . test

.PHONY: *
.DEFAULT_GOAL: make-default

Expand Down
4 changes: 2 additions & 2 deletions make/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/anchore/chronicle/make

go 1.22.0
go 1.22.1

require github.com/anchore/go-make v0.0.0-20241021192429-7e18af0fc7f9
require github.com/anchore/go-make v0.0.0-20241022203551-494d90ce1a4a

require (
github.com/kr/text v0.2.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions make/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
github.com/anchore/go-make v0.0.0-20241021192429-7e18af0fc7f9 h1:LvLPfZd31lsrqw5XF45RIsIA1p11DC0Z2hDEe74kUEw=
github.com/anchore/go-make v0.0.0-20241021192429-7e18af0fc7f9/go.mod h1:y2KCL40/pLMqMu5PGqxGUs/1taaQjZVkuCGXFi9Lcic=
github.com/anchore/go-make v0.0.0-20241022203551-494d90ce1a4a h1:ttcnRZCKhNWkBem7L4HVk60lVx2HwWPjOPX9NH9/LuQ=
github.com/anchore/go-make v0.0.0-20241022203551-494d90ce1a4a/go.mod h1:y2KCL40/pLMqMu5PGqxGUs/1taaQjZVkuCGXFi9Lcic=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
Expand Down
64 changes: 40 additions & 24 deletions make/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,51 @@ import (
)

func main() {
fixturesTask := Task{
Name: "fixtures",
Desc: "build test fixtures",
Run: func() {
InDir("internal/git/test-fixtures", func() {
Run("make")
})

InDir("chronicle/release/releasers/github/test-fixtures", func() {
Run("make")
})
},
}

fixturesFingerprintTask := Task{
Name: "fixtures-fingerprint",
Desc: "get test fixtures cache fingerprint",
Quiet: true,
Run: func() {
Log(FingerprintGlobs("internal/git/test-fixtures/*.sh"))
},
}

Makefile(
RollupTask("default", "run all validations", "static-analysis", "test"),
golint.Tasks(),
release.Tasks(),
fixturesFingerprintTask,
fixturesTask,
gotest.Test("unit"),
gotest.Test("unit", gotest.WithDependencies(fixturesTask.Name)),
)
}

var fixturesTask = Task{
Name: "fixtures",
Desc: "build test fixtures",
Run: func() {
InDir("internal/git/test-fixtures", func() {
Run("make")
})

InDir("chronicle/release/releasers/github/test-fixtures", func() {
Run("make")
})
},
Tasks: []Task{
{
Name: "fixtures:clean",
Desc: "clean internal git test fixture caches",
Labels: All("clean"),
Run: func() {
InDir("internal/git/test-fixtures", func() {
Run("make clean")
})

InDir("chronicle/release/releasers/github/test-fixtures", func() {
Run("make clean")
})
},
},
},
}

var fixturesFingerprintTask = Task{
Name: "fixtures-fingerprint",
Desc: "get test fixtures cache fingerprint",
Quiet: true,
Run: func() {
Log(FingerprintGlobs("internal/git/test-fixtures/*.sh"))
},
}

0 comments on commit 5d227ea

Please sign in to comment.