Skip to content

Commit

Permalink
Merge pull request #77 from cpuguy83/update_builds
Browse files Browse the repository at this point in the history
Clean up build stuff
  • Loading branch information
cpuguy83 authored Feb 4, 2024
2 parents f67b5f6 + 6bf89fd commit b19b556
Show file tree
Hide file tree
Showing 19 changed files with 42 additions and 8,346 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Go
name: CI

on:
push:
Expand All @@ -11,7 +11,7 @@ jobs:
name: Build
strategy:
matrix:
go-version: [1.13.x, 1.15.x, 1.16.x, 1.17.x, 1.18.x]
go-version: [1.18.x, 1.19.x, 1.20.x, 1.21.x]
platform: [ubuntu-20.04]
runs-on: ${{ matrix.platform }}
steps:
Expand All @@ -24,15 +24,15 @@ jobs:
uses: actions/checkout@v4

- name: Build
run: go build -v ./...
run: make build

- name: Test
run: go test -v ./...
run: make test

lint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: golangci/[email protected]
with:
version: v1.51
version: v1.55
20 changes: 7 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
ARG GO_VERSION=1.18
ARG GO_IMAGE=golang:${GO_VERSION}
ARG GO_VERSION=1.21

FROM --platform=$BUILDPLATFORM $GO_IMAGE AS build
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS build
COPY . /go/src/github.com/cpuguy83/go-md2man
WORKDIR /go/src/github.com/cpuguy83/go-md2man
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
ARG TARGETOS TARGETARCH TARGETVARIANT
RUN \
export GOOS="${TARGETOS}"; \
export GOARCH="${TARGETARCH}"; \
if [ "${TARGETARCH}" = "arm" ] && [ "${TARGETVARIANT}" ]; then \
export GOARM="${TARGETVARIANT#v}"; \
fi; \
CGO_ENABLED=0 go build
--mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
make build

FROM scratch
COPY --from=build /go/src/github.com/cpuguy83/go-md2man/go-md2man /go-md2man
COPY --from=build /go/src/github.com/cpuguy83/go-md2man/bin/go-md2man /go-md2man
ENTRYPOINT ["/go-md2man"]
46 changes: 30 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,34 @@
GO111MODULE ?= on
LINTER_BIN ?= golangci-lint

export GO111MODULE

GOOS ?= $(if $(TARGETOS),$(TARGETOS),)
GOARCH ?= $(if $(TARGETARCH),$(TARGETARCH),)

ifeq ($(TARGETARCH),amd64)
GOAMD64 ?= $(TARGETVARIANT)
endif

ifeq ($(TARGETARCH),arm)
GOARM ?= $(TARGETVARIANT:v%=%)
endif

ifneq ($(GOOS),)
export GOOS
endif

ifneq ($(GOARCH),)
export GOARCH
endif

ifneq ($(GOAMD64),)
export GOAMD64
endif

ifneq ($(GOARM),)
export GOARM
endif

.PHONY:
build: bin/go-md2man

Expand All @@ -14,22 +40,10 @@ clean:
test:
@go test $(TEST_FLAGS) ./...

bin/go-md2man: actual_build_flags := $(BUILD_FLAGS) -o bin/go-md2man
bin/go-md2man: bin
@CGO_ENABLED=0 go build $(actual_build_flags)

bin:
@mkdir ./bin
bin/go-md2man: go.mod go.sum md2man/* *.go
@mkdir -p bin
CGO_ENABLED=0 go build $(BUILD_FLAGS) -o $@

.PHONY: mod
mod:
@go mod tidy

.PHONY: check-mod
check-mod: # verifies that module changes for go.mod and go.sum are checked in
@hack/ci/check_mods.sh

.PHONY: vendor
vendor: mod
@go mod vendor -v

9 changes: 0 additions & 9 deletions hack/ci/check_mods.sh

This file was deleted.

8 changes: 0 additions & 8 deletions vendor/github.com/russross/blackfriday/v2/.gitignore

This file was deleted.

17 changes: 0 additions & 17 deletions vendor/github.com/russross/blackfriday/v2/.travis.yml

This file was deleted.

29 changes: 0 additions & 29 deletions vendor/github.com/russross/blackfriday/v2/LICENSE.txt

This file was deleted.

Loading

0 comments on commit b19b556

Please sign in to comment.