mirror of
https://github.com/creack/pty.git
synced 2026-03-31 02:27:08 +09:00
Update cross compile test for go1.16
This commit is contained in:
17
Dockerfile.golang
Normal file
17
Dockerfile.golang
Normal file
@@ -0,0 +1,17 @@
|
||||
ARG GOVERSION=1.14
|
||||
FROM golang:${GOVERSION}
|
||||
|
||||
# Set base env.
|
||||
ARG GOOS=linux
|
||||
ARG GOARCH=amd64
|
||||
ENV GOOS=${GOOS} GOARCH=${GOARCH} CGO_ENABLED=0 GOFLAGS='-v -ldflags=-s -ldflags=-w'
|
||||
|
||||
# Pre compile the stdlib for 386/arm (32bits).
|
||||
RUN go build -a std
|
||||
|
||||
# Add the code to the image.
|
||||
WORKDIR pty
|
||||
ADD . .
|
||||
|
||||
# Build the lib.
|
||||
RUN go build
|
||||
@@ -1,3 +1,4 @@
|
||||
# NOTE: Using 1.13 as a base to build the RISCV compiler, the resulting version is based on go1.6.
|
||||
FROM golang:1.13
|
||||
|
||||
# Clone and complie a riscv compatible version of the go compiler.
|
||||
@@ -8,7 +9,15 @@ ENV PATH=/riscv-go/misc/riscv:/riscv-go/bin:$PATH
|
||||
RUN cd /riscv-go/src && GOROOT_BOOTSTRAP=$(go env GOROOT) ./make.bash
|
||||
ENV GOROOT=/riscv-go
|
||||
|
||||
# Make sure we compile.
|
||||
# Set the base env.
|
||||
ENV GOOS=linux GOARCH=riscv CGO_ENABLED=0 GOFLAGS='-v -ldflags=-s -ldflags=-w'
|
||||
|
||||
# Pre compile the stdlib.
|
||||
RUN go build -a std
|
||||
|
||||
# Add the code to the image.
|
||||
WORKDIR pty
|
||||
ADD . .
|
||||
RUN GOOS=linux GOARCH=riscv go build
|
||||
|
||||
# Build the lib.
|
||||
RUN go build
|
||||
|
||||
2
doc.go
2
doc.go
@@ -10,7 +10,7 @@ import (
|
||||
// available on the current platform.
|
||||
var ErrUnsupported = errors.New("unsupported")
|
||||
|
||||
// Opens a pty and its corresponding tty.
|
||||
// Open a pty and its corresponding tty.
|
||||
func Open() (pty, tty *os.File, err error) {
|
||||
return open()
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ cross() {
|
||||
shift
|
||||
echo2 "Build for $os."
|
||||
for arch in $@; do
|
||||
echo2 " - $os/$arch"
|
||||
GOOS=$os GOARCH=$arch go build
|
||||
echo2 " - $os/$arch"
|
||||
GOOS=$os GOARCH=$arch go build
|
||||
done
|
||||
echo2
|
||||
}
|
||||
@@ -26,7 +26,7 @@ cross() {
|
||||
set -e
|
||||
|
||||
cross linux amd64 386 arm arm64 ppc64 ppc64le s390x mips mipsle mips64 mips64le
|
||||
cross darwin amd64 386 arm arm64
|
||||
cross darwin amd64 arm64
|
||||
cross freebsd amd64 386 arm
|
||||
cross netbsd amd64 386 arm
|
||||
cross openbsd amd64 386 arm arm64
|
||||
@@ -47,4 +47,18 @@ fi
|
||||
|
||||
echo2 "Build for linux."
|
||||
echo2 " - linux/riscv"
|
||||
docker build -t test -f Dockerfile.riscv .
|
||||
docker build -t creack-pty-test -f Dockerfile.riscv .
|
||||
|
||||
# Golang dropped support for darwin 32bits since go1.15. Make sure the lib still compile with go1.14 on those archs.
|
||||
echo2 "Build for darwin (32bits)."
|
||||
echo2 " - darwin/386"
|
||||
docker build -t creack-pty-test -f Dockerfile.golang --build-arg=GOVERSION=1.14 --build-arg=GOOS=darwin --build-arg=GOARCH=386 .
|
||||
echo2 " - darwin/arm"
|
||||
docker build -t creack-pty-test -f Dockerfile.golang --build-arg=GOVERSION=1.14 --build-arg=GOOS=darwin --build-arg=GOARCH=arm .
|
||||
|
||||
# Run a single test for an old go version. Would be best with go1.0, but not available on Dockerhub.
|
||||
# Using 1.6 as it is the base version for the RISCV compiler.
|
||||
# Would also be better to run all the tests, not just one, need to refactor this file to allow for specifc archs per version.
|
||||
echo2 "Build for linux - go1.6."
|
||||
echo2 " - linux/amd64"
|
||||
docker build -t creack-pty-test -f Dockerfile.golang --build-arg=GOVERSION=1.6 --build-arg=GOOS=linux --build-arg=GOARCH=amd64 .
|
||||
|
||||
Reference in New Issue
Block a user