diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dd3f67c..ee7e6fe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,33 +2,32 @@ name: Go on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: - test: name: Build strategy: matrix: - go-version: [1.13.x, 1.15.x, 1.16.x] + go-version: [1.13.x, 1.15.x, 1.16.x, 1.17.x, 1.18.x] platform: [ubuntu-20.04] runs-on: ${{ matrix.platform }} steps: - - name: Install Go - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go-version }} + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go-version }} - - name: Check out code into the Go module directory - uses: actions/checkout@v3 + - name: Check out code into the Go module directory + uses: actions/checkout@v3 - - name: Build - run: go build -v ./... + - name: Build + run: go build -v ./... - - name: Test - run: go test -v ./... + - name: Test + run: go test -v ./... lint: runs-on: ubuntu-20.04 diff --git a/Dockerfile b/Dockerfile index 97bec82..7181c53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,19 @@ -FROM golang:1.8 AS build +ARG GO_VERSION=1.18 +ARG GO_IMAGE=golang:${GO_VERSION} + +FROM --platform=$BUILDPLATFORM $GO_IMAGE AS build COPY . /go/src/github.com/cpuguy83/go-md2man WORKDIR /go/src/github.com/cpuguy83/go-md2man -RUN CGO_ENABLED=0 go build +ARG TARGETOS +ARG TARGETARCH +ARG TARGETVARIANT +RUN \ + export GOOS="${TARGETOS}"; \ + export GOARCH="${TARGETARCH}"; \ + if [ "${TARGETARCH}" = "arm" ] && [ "${TARGETVARIANT}" ]; then \ + export GOARM="${TARGETVARIANT#v}"; \ + fi; \ + CGO_ENABLED=0 go build FROM scratch COPY --from=build /go/src/github.com/cpuguy83/go-md2man/go-md2man /go-md2man