Skip to content

Commit

Permalink
Feature/goreleaser (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
yindia authored Feb 15, 2021
1 parent 4367c0b commit 22c203b
Show file tree
Hide file tree
Showing 36 changed files with 280 additions and 259 deletions.
Empty file.
File renamed without changes.
31 changes: 31 additions & 0 deletions flytectl/.github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: build

on:
pull_request:
push:

jobs:
build:
name: Run tests and lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Unit Tests
uses: cedrickring/[email protected]
env:
GO111MODULE: "on"
with:
args: make install && make test_unit_codecov
- name: Push CodeCov
uses: codecov/codecov-action@v1
with:
file: coverage.txt
flags: unittests
fail_ci_if_error: true
- name: Lint
uses: cedrickring/[email protected]
env:
GO111MODULE: "on"
with:
args: make install && make lint
38 changes: 38 additions & 0 deletions flytectl/.github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: releaser
on:
push:
tags:
- 'v*'

jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Unit Tests
uses: cedrickring/[email protected]
env:
GO111MODULE: "on"
with:
args: make install && make test_unit_codecov
- name: Push CodeCov
uses: codecov/codecov-action@v1
with:
file: coverage.txt
flags: unittests
fail_ci_if_error: true
- name: Lint
uses: cedrickring/[email protected]
env:
GO111MODULE: "on"
with:
args: make install && make lint

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist --debug
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62 changes: 10 additions & 52 deletions flytectl/.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ builds:
- windows
- darwin
ldflags:
- -s -w -X github.com/lyft/flytestdlib/version.Version={{.Version}} -X github.com/lyft/flytestdlib/version.Build={{.ShortCommit}} -X github.com/lyft/flytestdlib/version.BuildTime={{.Date}}
- -s -w -X github.com/flyteorg/flytestdlib/version.Version={{.Version}} -X github.com/flyteorg/flytestdlib/version.Build={{.ShortCommit}} -X github.com/flyteorg/flytestdlib/version.BuildTime={{.Date}}
archives:
- replacements:
darwin: macOS
Expand All @@ -38,7 +38,7 @@ scoop:

# Repository to push the app manifest to.
bucket:
owner: lyft
owner: flyteorg
name: flytectl

# Git author used to commit to the repository.
Expand All @@ -49,7 +49,7 @@ scoop:

# Your app's homepage.
# Default is empty.
homepage: "https://godoc.org/github.com/lyft/flytectl"
homepage: "https://godoc.org/github.com/flyteorg/flytectl"

# Your app's description.
# Default is empty.
Expand All @@ -61,19 +61,12 @@ scoop:

# Persist data between application updates
persist:
- "data"
- "config.toml"
brews:
- # Name template of the recipe
# Default to project name
name: flytectl

# IDs of the archives to use.
# Defaults to all.
# ids:
# - foo
# - bar

# GOARM to specify which 32-bit arm version to use if there are multiple versions
# from the build section. Brew formulas support atm only one 32-bit version.
# Default is 6 for all artifacts or each id if there a multiple versions.
Expand All @@ -83,21 +76,14 @@ brews:
# same kind. We will probably unify this in the next major version like it is done with scoop.

# Github repository to push the tap to.
github:
owner: github-user
name: homebrew-tap

# OR Gitlab
# gitlab:
# owner: gitlab-user
# name: homebrew-tap

# Gitea is not supported yet, but the support coming
tap:
owner: flyteorg
name: flytectl

# Template for the url which is determined by the given Token (github or gitlab)
# Default for github is "https://github.com/<repo_owner>/<repo_name>/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
# Default for gitlab is "https://gitlab.com/<repo_owner>/<repo_name>/uploads/{{ .ArtifactUploadHash }}/{{ .ArtifactName }}"
url_template: "http://github.com/lyft/flytectl/releases/{{ .Tag }}/{{ .ArtifactName }}"
url_template: "http://github.com/flyteorg/flytectl/releases/{{ .Tag }}/{{ .ArtifactName }}"

# Allows you to set a custom download strategy. Note that you'll need
# to implement the strategy and add it to your tap repository.
Expand All @@ -112,20 +98,16 @@ brews:
# Git author used to commit to the repository.
# Defaults are shown.
commit_author:
name: goreleaserbot
email: [email protected]

# Folder inside the repository to put the formula.
# Default is the root folder.
folder: Formula
name: flytebot
email: [email protected]

# Caveats for the user of your binary.
# Default is empty.
caveats: "How to use this binary"

# Your app's homepage.
# Default is empty.
homepage: "https://godoc.org/github.com/lyft/flytectl"
homepage: "https://flytectl.readthedocs.io/en/latest"

# Your app's description.
# Default is empty.
Expand All @@ -139,30 +121,6 @@ brews:
# Default is false.
skip_upload: auto

# Custom block for brew.
# Can be used to specify alternate downloads for devel or head releases.
# Default is empty.
# custom_block: |
# head "https://github.com/some/package.git"
# ...

# Packages your package depends on.
# dependencies:
# - name: git
# - name: zsh
# type: optional

# Packages that conflict with your package.
# conflicts:
# - svn
# - bash

# Specify for packages that run as a service.
# Default is empty.
# plist: |
# <?xml version="1.0" encoding="UTF-8"?>
# ...

# So you can `brew test` your formula.
# Default is empty.
test: system "#{bin}/program --version"
Expand Down
2 changes: 1 addition & 1 deletion flytectl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Generating docs locally can be accomplished by running make gendocs from within
## Installation

```bash
curl -s https://raw.githubusercontent.com/lyft/flytectl/master/install.sh | bash
curl -s https://raw.githubusercontent.com/flyteorg/flytectl/master/install.sh | bash
```

## Contributing
Expand Down
2 changes: 1 addition & 1 deletion flytectl/boilerplate/lyft/golang_support_tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
package tools

import (
_ "github.com/alvaroloes/enumer"
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
_ "github.com/lyft/flytestdlib/cli/pflags"
_ "github.com/vektra/mockery/cmd/mockery"
_ "github.com/alvaroloes/enumer"
)
1 change: 1 addition & 0 deletions flytectl/cmd/core/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmdcore
import (
"context"
"fmt"

"github.com/spf13/pflag"

"github.com/lyft/flyteidl/clients/go/admin"
Expand Down
2 changes: 1 addition & 1 deletion flytectl/cmd/core/cmd_ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type CommandContext struct {
}

func NewCommandContext(adminClient service.AdminServiceClient, out io.Writer) CommandContext {
return CommandContext{adminClient: adminClient, out : out}
return CommandContext{adminClient: adminClient, out: out}
}

func (c CommandContext) AdminClient() service.AdminServiceClient {
Expand Down
17 changes: 9 additions & 8 deletions flytectl/cmd/get/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package get

import (
"context"

"github.com/lyft/flyteidl/gen/pb-go/flyteidl/core"

"github.com/golang/protobuf/proto"
Expand All @@ -13,7 +14,7 @@ import (
"github.com/lyft/flytectl/pkg/printer"
)

const(
const (
executionShort = "Gets execution resources"
executionLong = `
Retrieves all the executions within project and domain.(execution,executions can be used interchangeably in these commands)
Expand Down Expand Up @@ -49,12 +50,12 @@ Usage
)

var executionColumns = []printer.Column{
{"Name", "$.id.name"},
{"Workflow Name", "$.closure.workflowId.name"},
{"Type", "$.closure.workflowId.resourceType"},
{"Phase", "$.closure.phase"},
{"Started", "$.closure.startedAt"},
{"Elapsed Time", "$.closure.duration"},
{Header: "Name", JSONPath: "$.id.name"},
{Header: "Workflow Name", JSONPath: "$.closure.workflowId.name"},
{Header: "Type", JSONPath: "$.closure.workflowId.resourceType"},
{Header: "Phase", JSONPath: "$.closure.phase"},
{Header: "Started", JSONPath: "$.closure.startedAt"},
{Header: "Elapsed Time", JSONPath: "$.closure.duration"},
}

func ExecutionToProtoMessages(l []*admin.Execution) []proto.Message {
Expand All @@ -67,7 +68,7 @@ func ExecutionToProtoMessages(l []*admin.Execution) []proto.Message {

func getExecutionFunc(ctx context.Context, args []string, cmdCtx cmdCore.CommandContext) error {
adminPrinter := printer.Printer{}
var executions []* admin.Execution
var executions []*admin.Execution
if len(args) > 0 {
name := args[0]
execution, err := cmdCtx.AdminClient().GetExecution(ctx, &admin.WorkflowExecutionGetRequest{
Expand Down
Loading

0 comments on commit 22c203b

Please sign in to comment.