Skip to content

Commit

Permalink
Add zig
Browse files Browse the repository at this point in the history
  • Loading branch information
outofforest committed Dec 27, 2024
1 parent e3a4f54 commit 36928f9
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 31 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
strategy:
matrix:
command: [
"lint",
"test",
"lint/go",
"test/go",
"tools/verify",
]

Expand All @@ -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
21 changes: 0 additions & 21 deletions build/cmd/builder/commands.go

This file was deleted.

3 changes: 2 additions & 1 deletion build/cmd/builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
3 changes: 2 additions & 1 deletion build/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions build/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
)
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
51 changes: 51 additions & 0 deletions pkg/tools/zig/tools.go
Original file line number Diff line number Diff line change
@@ -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...)
}

0 comments on commit 36928f9

Please sign in to comment.