Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix darwin build and make sure it is enabled on cross #110

Merged
merged 3 commits into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
9 changes: 1 addition & 8 deletions copy/copy_unix.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build solaris || darwin || freebsd
// +build solaris darwin freebsd

package fs
Expand Down Expand Up @@ -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)
}
20 changes: 20 additions & 0 deletions copy/device_darwin.go
Original file line number Diff line number Diff line change
@@ -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))
}
20 changes: 20 additions & 0 deletions copy/device_freebsd.go
Original file line number Diff line number Diff line change
@@ -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)
}
2 changes: 1 addition & 1 deletion docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}