mirror of
https://github.com/abice/go-enum.git
synced 2026-10-28 08:35:35 +08:00
use go base image
This commit is contained in:
1 parent
4e336ab1ee
commit
f2bc4fe081
5 files changed
+34
-11
No files matched your search
@@ -13,9 +13,6 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
go:
|
||||
# Drop support of go 1.17
|
||||
- "1.18"
|
||||
- "1.19"
|
||||
- "1.20"
|
||||
- "1.21"
|
||||
name: run tests with go version ${{ matrix.go }}
|
||||
|
||||
@@ -21,6 +21,7 @@ archives:
|
||||
|
||||
kos:
|
||||
- repository: abice/go-enum
|
||||
base_image: cgr.dev/chainguard/go # need the go binary for formatting 🔧 purposes 🫤
|
||||
tags:
|
||||
- "{{.Version}}"
|
||||
- latest
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
defaultBaseImage: cgr.dev/chainguard/go # For now, we need the go binary in order to format go files.
|
||||
defaultPlatforms:
|
||||
- linux/arm64
|
||||
- linux/amd64
|
||||
|
||||
builds:
|
||||
- id: go-enum
|
||||
dir: . # default is .
|
||||
main: .
|
||||
flags:
|
||||
- -tags
|
||||
- netgo
|
||||
ldflags:
|
||||
- -s -w
|
||||
- -extldflags "-static"
|
||||
- -X "main.version={{.Env.VERSION}}"
|
||||
- -X "main.commit={{.Env.COMMIT}}"
|
||||
- -X "main.date={{.Env.DATE}}"
|
||||
- -X "main.builtBy={{.Env.BUILT_BY}}"
|
||||
@@ -99,28 +99,26 @@ bin/goveralls: go.sum
|
||||
$(call goinstall,github.com/mattn/goveralls)
|
||||
|
||||
# snapshots: snapshots_1.17
|
||||
snapshots: snapshots_1.20
|
||||
snapshots: snapshots_1.21
|
||||
|
||||
snapshots_%: clean
|
||||
echo "##### updating snapshots for golang $* #####"
|
||||
docker run -i -t -w /app -v $(shell pwd):/app --entrypoint /bin/sh golang:$* -c './update-snapshots.sh || true'
|
||||
|
||||
.PHONY: ci
|
||||
# ci: docker_1.16
|
||||
# ci: docker_1.17
|
||||
ci: docker_1.18
|
||||
ci: docker_1.19
|
||||
ci: docker_1.20
|
||||
ci: docker_1.21
|
||||
|
||||
docker_%:
|
||||
echo "##### testing golang $* #####"
|
||||
docker run -i -t -w /app -v $(shell pwd):/app --entrypoint /bin/sh golang:$* -c 'make clean && make'
|
||||
|
||||
.PHONY: pullimages
|
||||
pullimages: pullimage_1.17
|
||||
pullimages: pullimage_1.18
|
||||
pullimages: pullimage_1.19
|
||||
pullimages: pullimage_1.20
|
||||
pullimages: pullimage_1.21
|
||||
|
||||
pullimage_%:
|
||||
docker pull golang:$*
|
||||
|
||||
build_docker:
|
||||
KO_DOCKER_REPO=abice/go-enum VERSION=$(GITHUB_REF) COMMIT=$(GITHUB_SHA) DATE=$(DATE) BUILT_BY=$(USER) ko build --bare --local
|
||||
@@ -88,6 +88,14 @@ It's not perfect, but I think it's useful.
|
||||
|
||||
I took the output of the [Stringer](https://godoc.org/golang.org/x/tools/cmd/stringer) command as the `String()` method, and added a way to parse a string value.
|
||||
|
||||
## Docker image
|
||||
|
||||
You can now use a docker image directly for running the command if you do not wish to install anything!
|
||||
|
||||
```shell
|
||||
docker run -w /app -v $(pwd):/app abice/go-enum:$(GO_ENUM_VERSION)
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
You can now download a release directly from github and use that for generating your enums! (Thanks to [GoReleaser](https://github.com/goreleaser/goreleaser-action))
|
||||
|
||||
Reference in new issue
Block a user