diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 69e13c7..842e0a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,8 +9,8 @@ jobs: strategy: matrix: command: [ - "lint", - "test", + "lint/go", + "test/go", "tools/verify", ] @@ -21,4 +21,4 @@ jobs: with: persist-credentials: false - name: Run ${{ matrix.command }} - run: bin/builder tidy ${{ matrix.command }} git/isclean + run: bin/builder tidy/go ${{ matrix.command }} git/isclean diff --git a/build/cmd/builder/commands.go b/build/cmd/builder/commands.go deleted file mode 100644 index 3f5f1aa..0000000 --- a/build/cmd/builder/commands.go +++ /dev/null @@ -1,21 +0,0 @@ -package main - -import ( - "github.com/outofforest/build/v2/pkg/types" - "github.com/outofforest/tools/pkg/tools/golang" -) - -var commands = map[string]types.Command{ - "lint": { - Description: "Lints code", - Fn: golang.Lint, - }, - "test": { - Description: "Runs unit tests", - Fn: golang.UnitTests, - }, - "tidy": { - Description: "Tidies up the code", - Fn: golang.Tidy, - }, -} diff --git a/build/cmd/builder/main.go b/build/cmd/builder/main.go index a8bfad5..79406b7 100644 --- a/build/cmd/builder/main.go +++ b/build/cmd/builder/main.go @@ -4,13 +4,14 @@ import ( "github.com/outofforest/build/v2" "github.com/outofforest/build/v2/pkg/tools/git" tmain "github.com/outofforest/tools" + "github.com/outofforest/tools/pkg/tools/golang" ) func main() { build.RegisterCommands( build.Commands, git.Commands, - commands, + golang.Commands, ) tmain.Main() } diff --git a/build/go.mod b/build/go.mod index d60a9e4..2e8afd2 100644 --- a/build/go.mod +++ b/build/go.mod @@ -5,7 +5,7 @@ go 1.22.0 replace github.com/outofforest/tools => ../ require ( - github.com/outofforest/build/v2 v2.3.1 + github.com/outofforest/build/v2 v2.4.0 github.com/outofforest/tools v1.0.7 ) @@ -18,6 +18,7 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/samber/lo v1.47.0 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/ulikunitz/xz v0.5.12 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/mod v0.22.0 // indirect diff --git a/build/go.sum b/build/go.sum index e03c614..20791e7 100644 --- a/build/go.sum +++ b/build/go.sum @@ -5,8 +5,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/outofforest/build/v2 v2.3.1 h1:pIzn3O0iQoWu8feY85wMfU1/kQ9BR7hvGIHTRknYJwk= -github.com/outofforest/build/v2 v2.3.1/go.mod h1:/Iq2feKJ0uViaXbMGK0I2449Mi188FnOwQM32ZUytpU= +github.com/outofforest/build/v2 v2.4.0 h1:DivJEpglIgvTeQ6v5rVCBOIlQQuaf0fYeDdaKSfA7Sk= +github.com/outofforest/build/v2 v2.4.0/go.mod h1:VAk235ilXcyAaMXrzVQepa4PpeHSsw7kk3Vp4vM/keA= github.com/outofforest/ioc/v2 v2.5.2 h1:4mNzLuzoZTXL/cO0qf1TrSYvejMgbZz5OUhdLzAUbek= github.com/outofforest/ioc/v2 v2.5.2/go.mod h1:yI+FHuHchC/t6nVo3WJ96qEgCXdHQKFI/4wW2/75YcU= github.com/outofforest/libexec v0.3.9 h1:KvVLuKDHqpydwNoKm+j36hi9DVPU61X4oHonlZ5cw88= @@ -38,6 +38,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= +github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= diff --git a/go.mod b/go.mod index ebb7f39..6cee6c4 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/outofforest/tools go 1.22.0 require ( - github.com/outofforest/build/v2 v2.3.1 + github.com/outofforest/build/v2 v2.4.0 github.com/outofforest/libexec v0.3.9 github.com/outofforest/logger v0.5.5 github.com/pkg/errors v0.9.1 @@ -16,6 +16,7 @@ require ( github.com/outofforest/parallel v0.2.3 // indirect github.com/outofforest/run v0.8.0 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/ulikunitz/xz v0.5.12 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/text v0.21.0 // indirect ) diff --git a/go.sum b/go.sum index eef7b60..39ebd38 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/outofforest/build/v2 v2.3.1 h1:pIzn3O0iQoWu8feY85wMfU1/kQ9BR7hvGIHTRknYJwk= -github.com/outofforest/build/v2 v2.3.1/go.mod h1:/Iq2feKJ0uViaXbMGK0I2449Mi188FnOwQM32ZUytpU= +github.com/outofforest/build/v2 v2.4.0 h1:DivJEpglIgvTeQ6v5rVCBOIlQQuaf0fYeDdaKSfA7Sk= +github.com/outofforest/build/v2 v2.4.0/go.mod h1:VAk235ilXcyAaMXrzVQepa4PpeHSsw7kk3Vp4vM/keA= github.com/outofforest/ioc/v2 v2.5.2 h1:4mNzLuzoZTXL/cO0qf1TrSYvejMgbZz5OUhdLzAUbek= github.com/outofforest/ioc/v2 v2.5.2/go.mod h1:yI+FHuHchC/t6nVo3WJ96qEgCXdHQKFI/4wW2/75YcU= github.com/outofforest/libexec v0.3.9 h1:KvVLuKDHqpydwNoKm+j36hi9DVPU61X4oHonlZ5cw88= @@ -38,6 +38,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= +github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= diff --git a/pkg/tools/zig/tools.go b/pkg/tools/zig/tools.go new file mode 100644 index 0000000..632ee4c --- /dev/null +++ b/pkg/tools/zig/tools.go @@ -0,0 +1,51 @@ +package zig + +import ( + "context" + + "github.com/outofforest/build/v2/pkg/tools" + "github.com/outofforest/build/v2/pkg/types" +) + +// Tool names. +const Zig tools.Name = "zig" + +var t = []tools.Tool{ + // https://ziglang.org/download/ + tools.BinaryTool{ + Name: Zig, + Version: "0.13.0", + Sources: tools.Sources{ + tools.PlatformLinuxAMD64: { + URL: "https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz", + Hash: "sha256:d45312e61ebcc48032b77bc4cf7fd6915c11fa16e4aad116b66c9468211230ea", + Links: map[string]string{ + "bin/zig": "zig-linux-x86_64-0.13.0/zig", + }, + }, + tools.PlatformDarwinAMD64: { + URL: "https://ziglang.org/download/0.13.0/zig-macos-x86_64-0.13.0.tar.xz", + Hash: "sha256:8b06ed1091b2269b700b3b07f8e3be3b833000841bae5aa6a09b1a8b4773effd", + Links: map[string]string{ + "bin/zig": "zig-macos-x86_64-0.13.0/zig", + }, + }, + tools.PlatformDarwinARM64: { + URL: "https://ziglang.org/download/0.13.0/zig-macos-aarch64-0.13.0.tar.xz", + Hash: "sha256:46fae219656545dfaf4dce12fb4e8685cec5b51d721beee9389ab4194d43394c", + Links: map[string]string{ + "bin/zig": "zig-macos-aarch64-0.13.0/zig", + }, + }, + }, + }, +} + +// EnsureZig ensures that zig is available. +func EnsureZig(ctx context.Context, _ types.DepsFunc) error { + return tools.Ensure(ctx, Zig, tools.PlatformLocal) +} + +func init() { + tools.Add(t...) +}