Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Added boilerplate automation (#43)
Browse files Browse the repository at this point in the history
Signed-off-by: Yuvraj <[email protected]>
  • Loading branch information
yindia authored May 27, 2021
1 parent c841290 commit 4017e1f
Show file tree
Hide file tree
Showing 30 changed files with 1,358 additions and 963 deletions.
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES.
# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY:
# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY:
#
# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst
# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst

run:
skip-dirs:
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
export REPOSITORY=datacatalog
include boilerplate/lyft/docker_build/Makefile
include boilerplate/lyft/golang_test_targets/Makefile
include boilerplate/flyte/docker_build/Makefile
include boilerplate/flyte/golang_test_targets/Makefile

.PHONY: update_boilerplate
update_boilerplate:
@curl https://raw.githubusercontent.com/flyteorg/boilerplate/master/boilerplate/update.sh -o boilerplate/update.sh
@boilerplate/update.sh

.PHONY: compile
Expand Down
12 changes: 12 additions & 0 deletions boilerplate/flyte/docker_build/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES.
# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY:
#
# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst

.PHONY: docker_build
docker_build:
IMAGE_NAME=$$REPOSITORY ./boilerplate/flyte/docker_build/docker_build.sh

.PHONY: dockerhub_push
dockerhub_push:
IMAGE_NAME=flyteorg/$$REPOSITORY REGISTRY=docker.io ./boilerplate/flyte/docker_build/docker_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ If git head has a git tag, the Dockerhub image will also be tagged ``<IMAGE>:<GI

**To Enable:**

Add ``lyft/docker_build`` to your ``boilerplate/update.cfg`` file.
Add ``flyteorg/docker_build`` to your ``boilerplate/update.cfg`` file.

Add ``include boilerplate/lyft/docker_build/Makefile`` in your main ``Makefile`` _after_ your REPOSITORY environment variable
Add ``include boilerplate/flyte/docker_build/Makefile`` in your main ``Makefile`` _after_ your REPOSITORY environment variable

::

REPOSITORY=<myreponame>
include boilerplate/lyft/docker_build/Makefile
include boilerplate/flyte/docker_build/Makefile

(this ensures the extra Make targets get included in your main Makefile)
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash

# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES.
# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY:
# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY:
#
# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst
# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst

set -e

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module github.com/lyft/boilerplate
module github.com/flyteorg/boilerplate

go 1.13
go 1.16

require (
github.com/alvaroloes/enumer v1.1.2
github.com/golangci/golangci-lint v1.22.2
github.com/lyft/flytestdlib v0.2.31
github.com/flyteorg/flytestdlib v0.3.22
github.com/golangci/golangci-lint v1.38.0
github.com/vektra/mockery v0.0.0-20181123154057-e78b021dcbb5
)

Expand Down
1,267 changes: 1,267 additions & 0 deletions boilerplate/flyte/golang_support_tools/go.sum

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package tools

import (
_ "github.com/alvaroloes/enumer"
_ "github.com/flyteorg/flytestdlib/cli/pflags"
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
_ "github.com/lyft/flytestdlib/cli/pflags"
_ "github.com/vektra/mockery/cmd/mockery"
)
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES.
# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY:
# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY:
#
# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst
# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst


.PHONY: download_tooling
download_tooling: #download dependencies (including test deps) for the package
@boilerplate/lyft/golang_test_targets/download_tooling.sh
@boilerplate/flyte/golang_test_targets/download_tooling.sh

.PHONY: lint
lint: download_tooling #lints the package for common code smells
Expand All @@ -16,7 +16,7 @@ lint: download_tooling #lints the package for common code smells
# skips 'vendor'
.PHONY: goimports
goimports:
@boilerplate/lyft/golang_test_targets/goimports
@boilerplate/flyte/golang_test_targets/goimports

.PHONY: mod_download
mod_download: #download dependencies (including test deps) for the package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ Provides a ``test_benchmark`` target for benchmark tests.

**To Enable:**

Add ``lyft/golang_test_targets`` to your ``boilerplate/update.cfg`` file.
Add ``flyteorg/golang_test_targets`` to your ``boilerplate/update.cfg`` file.

Make sure you're using ``go mod`` for dependency management.

Provide a ``.golangci`` configuration (the lint target requires it).

Add ``include boilerplate/lyft/golang_test_targets/Makefile`` in your main ``Makefile`` _after_ your REPOSITORY environment variable
Add ``include boilerplate/flyte/golang_test_targets/Makefile`` in your main ``Makefile`` _after_ your REPOSITORY environment variable

::

REPOSITORY=<myreponame>
include boilerplate/lyft/golang_test_targets/Makefile
include boilerplate/flyte/golang_test_targets/Makefile

(this ensures the extra make targets get included in your main Makefile)
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# pins. To facilitate this, we're maintaining two sets of go.mod/sum files - the second one only for tooling. This is
# the same approach that go 1.14 will take as well.
# See:
# https://github.com/lyft/flyte/issues/129
# https://github.com/flyteorg/flyte/issues/129
# https://github.com/golang/go/issues/30515 for some background context
# https://github.com/go-modules-by-example/index/blob/5ec250b4b78114a55001bd7c9cb88f6e07270ea5/010_tools/README.md

Expand All @@ -17,14 +17,14 @@ set -e
# In the format of "<cli>:<package>" or ":<package>" if no cli
tools=(
"github.com/vektra/mockery/cmd/mockery"
"github.com/lyft/flytestdlib/cli/pflags"
"github.com/flyteorg/flytestdlib/cli/pflags"
"github.com/golangci/golangci-lint/cmd/golangci-lint"
"github.com/alvaroloes/enumer"
)

tmp_dir=$(mktemp -d -t gotooling-XXX)
echo "Using temp directory ${tmp_dir}"
cp -R boilerplate/lyft/golang_support_tools/* $tmp_dir
cp -R boilerplate/flyte/golang_support_tools/* $tmp_dir
pushd "$tmp_dir"

for tool in "${tools[@]}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash

# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES.
# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY:
# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY:
#
# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst
# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst

goimports -w $(find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./pkg/client/*")
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES.
# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY:
# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY:
#
# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst
# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst

run:
skip-dirs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Provides a ``.golangci`` file with the linters we've agreed upon.

**To Enable:**

Add ``lyft/golangci_file`` to your ``boilerplate/update.cfg`` file.
Add ``flyteorg/golangci_file`` to your ``boilerplate/update.cfg`` file.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash

# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES.
# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY:
# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY:
#
# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst
# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst

set -e

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Provides a Pull Request template.

**To Enable:**

Add ``lyft/golang_test_targets`` to your ``boilerplate/update.cfg`` file.
Add ``flyteorg/golang_test_targets`` to your ``boilerplate/update.cfg`` file.
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Read then delete

- Make sure to use a concise title for the pull-request.
- Use #patch, #minor or #major in the pull-request title to bump the corresponding version. Otherwise, the patch version
will be bumped. [More details](https://github.com/marketplace/actions/github-tag-bump)

# TL;DR
_Please replace this text with a description of what this PR accomplishes._

Expand All @@ -18,9 +24,9 @@ _Please replace this text with a description of what this PR accomplishes._
_How did you fix the bug, make the feature etc. Link to any design docs etc_

## Tracking Issue
https://github.com/lyft/flyte/issues/<number>
https://github.com/flyteorg/flyte/issues/<number>

## Follow-up issue
_NA_
OR
_https://github.com/lyft/flyte/issues/<number>_
_https://github.com/flyteorg/flyte/issues/<number>_
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash

# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES.
# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY:
# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY:
#
# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst
# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst

set -e

Expand Down
12 changes: 0 additions & 12 deletions boilerplate/lyft/docker_build/Makefile

This file was deleted.

20 changes: 0 additions & 20 deletions boilerplate/lyft/github_workflows/Readme.rst

This file was deleted.

Loading

0 comments on commit 4017e1f

Please sign in to comment.