Skip to content

Commit

Permalink
Build commands, noun verb order
Browse files Browse the repository at this point in the history
Commands are now reworked to support 'noun verb' order.
Build subcommand is added, shipwright CLI is now able to
create, delete and list build objects in Kubernetes.
Added github actions for unit tests
  • Loading branch information
Alice Rum committed Mar 18, 2021
1 parent 23ba9c1 commit 19ee9e4
Show file tree
Hide file tree
Showing 35 changed files with 754 additions and 522 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/unit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Unit Tests

on:
push:
tags-ignore:
- '**'
branches:
- main
pull_request:
branches:
- main

jobs:
test:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ^1.16

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Install Tools
run: sudo apt-get update && sudo apt-get install -y make gcc

- name: Build Application
run: make build

- name: Run Unit Tests
run: make test
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

6 changes: 4 additions & 2 deletions cmd/shp/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import (
"fmt"
"os"

"github.com/otaviof/shp/pkg/shp/cmd"
"github.com/spf13/pflag"

"k8s.io/cli-runtime/pkg/genericclioptions"

"github.com/shipwright-io/cli/pkg/shp/cmd"
)

// ApplicationName application name.
const ApplicationName = "kubectl-shp"
const ApplicationName = "shp"

func main() {
flags := pflag.NewFlagSet(ApplicationName, pflag.ExitOnError)
Expand Down
88 changes: 0 additions & 88 deletions pkg/shp/buildrun/build_run.go

This file was deleted.

61 changes: 0 additions & 61 deletions pkg/shp/buildrun/build_run_test.go

This file was deleted.

26 changes: 0 additions & 26 deletions pkg/shp/buildrun/create.go

This file was deleted.

16 changes: 0 additions & 16 deletions pkg/shp/buildrun/delete.go

This file was deleted.

3 changes: 0 additions & 3 deletions pkg/shp/buildrun/doc.go

This file was deleted.

11 changes: 0 additions & 11 deletions pkg/shp/buildrun/util.go

This file was deleted.

52 changes: 52 additions & 0 deletions pkg/shp/cmd/build/build.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package build

import (
"os"

buildv1alpha1 "github.com/shipwright-io/build/pkg/apis/build/v1alpha1"
"github.com/spf13/cobra"

"k8s.io/cli-runtime/pkg/genericclioptions"

"github.com/shipwright-io/cli/pkg/shp/cmd/runner"
"github.com/shipwright-io/cli/pkg/shp/params"
"github.com/shipwright-io/cli/pkg/shp/resource"
)

var (
buildResource *resource.Resource
)

// Command returns Build subcommand of Shipwright CLI
// for interaction with shipwright builds
func Command(p *params.Params) *cobra.Command {
buildResource = resource.NewShpResource(
p,
buildv1alpha1.SchemeGroupVersion,
"Build",
"builds",
)

command := &cobra.Command{
Use: "build",
Aliases: []string{"bd"},
Short: "Manage Builds",
Annotations: map[string]string{
"commandType": "main",
},
}

streams := genericclioptions.IOStreams{
In: os.Stdin,
Out: os.Stdout,
ErrOut: os.Stderr,
}

// TODO: add support for `update` and `get` commands
command.AddCommand(
runner.NewRunner(p, streams, createCmd()).Cmd(),
runner.NewRunner(p, streams, listCmd()).Cmd(),
runner.NewRunner(p, streams, deleteCmd()).Cmd(),
)
return command
}
Loading

0 comments on commit 19ee9e4

Please sign in to comment.