diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee12cc0c..fadf7053 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - GO_VERSION: ["1.13", "1.14", "1.15", "1.16"] + GO_VERSION: ["1.16", "1.17"] env: GO_VERSION: ${{ matrix.GO_VERSION }} steps: @@ -41,6 +41,36 @@ jobs: run: | docker buildx bake cross + test-macos: + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + go: + - 1.16 + - 1.17 + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} + - + name: Cache Go modules + uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go-${{ matrix.go }}- + - + name: Test + run: | + go test ./... + test-freebsd-amd64: runs-on: macos-latest env: diff --git a/copy/copy_unix.go b/copy/copy_unix.go index a85b3134..22281ba5 100644 --- a/copy/copy_unix.go +++ b/copy/copy_unix.go @@ -1,3 +1,4 @@ +//go:build solaris || darwin || freebsd // +build solaris darwin freebsd package fs @@ -51,11 +52,3 @@ func (c *copier) copyFileInfo(fi os.FileInfo, name string) error { } return nil } - -func copyDevice(dst string, fi os.FileInfo) error { - st, ok := fi.Sys().(*syscall.Stat_t) - if !ok { - return errors.New("unsupported stat type") - } - return unix.Mknod(dst, uint32(fi.Mode()), st.Rdev) -} diff --git a/copy/device_darwin.go b/copy/device_darwin.go new file mode 100644 index 00000000..8a06d242 --- /dev/null +++ b/copy/device_darwin.go @@ -0,0 +1,20 @@ +//go:build darwin +// +build darwin + +package fs + +import ( + "os" + "syscall" + + "github.com/pkg/errors" + "golang.org/x/sys/unix" +) + +func copyDevice(dst string, fi os.FileInfo) error { + st, ok := fi.Sys().(*syscall.Stat_t) + if !ok { + return errors.New("unsupported stat type") + } + return unix.Mknod(dst, uint32(fi.Mode()), int(st.Rdev)) +} diff --git a/copy/device_freebsd.go b/copy/device_freebsd.go new file mode 100644 index 00000000..64a2fe4d --- /dev/null +++ b/copy/device_freebsd.go @@ -0,0 +1,20 @@ +//go:build freebsd || solaris +// +build freebsd solaris + +package fs + +import ( + "os" + "syscall" + + "github.com/pkg/errors" + "golang.org/x/sys/unix" +) + +func copyDevice(dst string, fi os.FileInfo) error { + st, ok := fi.Sys().(*syscall.Stat_t) + if !ok { + return errors.New("unsupported stat type") + } + return unix.Mknod(dst, uint32(fi.Mode()), st.Rdev) +} diff --git a/docker-bake.hcl b/docker-bake.hcl index c1569825..0d3c5417 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -63,5 +63,5 @@ target "shfmt" { target "cross" { inherits = ["build"] - platforms = ["linux/amd64", "linux/386", "linux/arm64", "linux/arm", "linux/ppc64le", "linux/s390x", "freebsd/amd64"] + platforms = ["linux/amd64", "linux/386", "linux/arm64", "linux/arm", "linux/ppc64le", "linux/s390x", "darwin/amd64", "darwin/arm64", "windows/amd64", "freebsd/amd64", "freebsd/arm64"] }