Skip to content

Instantly share code, notes, and snippets.

@neil-hickey
Created June 23, 2022 18:32
Show Gist options
  • Save neil-hickey/5ef41f1df3a4bb63962fc2d577cb32d0 to your computer and use it in GitHub Desktop.
Save neil-hickey/5ef41f1df3a4bb63962fc2d577cb32d0 to your computer and use it in GitHub Desktop.
#@ load("@ytt:data", "data")
#@ def registry_image(repository, name, tag="latest"):
name: #@ name
type: registry-image
icon: docker
source:
repository: #@ repository
tag: #@ tag
#@ end
#@ def lint_and_test_golang_mock():
platform: linux
inputs:
- name: golang-mock-git
path: go/src/github.com/golang/mock
params:
GO111MODULE: "on"
run:
path: /bin/sh
args:
- -c
- |
GOPATH=$PWD/go
cd go/src/github.com/golang/mock
go vet ./...
go build ./...
go install github.com/golang/mock/mockgen
GO111MODULE=off go get -u golang.org/x/lint/golint
./ci/check_go_fmt.sh
./ci/check_go_lint.sh
./ci/check_go_generate.sh
./ci/check_go_mod.sh
go test -v ./...
#@ end
---
resources:
#@ for/end version in data.values.versions:
- #@ registry_image("golang", "golang-" + version + ".x-image", version + "-stretch")
- name: golang-mock-git
type: git
icon: github
source:
uri: https://github.com/golang/mock.git
jobs:
#@ for/end version in data.values.versions:
- name: #@ "golang-" + version
public: true
plan:
- get: golang-mock-git
trigger: true
- get: #@ "golang-" + version + ".x-image"
trigger: true
- task: run-tests
image: #@ "golang-" + version + ".x-image"
config: #@ lint_and_test_golang_mock()
#@data/values
---
versions: ["1.11", "1.12", "1.13"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment