Skip to content

Commit

Permalink
[vergo:major-release]migrate module to github.com/sky-uk/vergo
Browse files Browse the repository at this point in the history
  • Loading branch information
mert committed Apr 20, 2022
1 parent 030c678 commit 44f1582
Show file tree
Hide file tree
Showing 28 changed files with 200 additions and 86 deletions.
18 changes: 5 additions & 13 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ builds:
ldflags:
- -s
- -w
- -X github.com/sky-uk/umc-shared/vergo/cmd.version={{.Env.GORELEASER_CURRENT_TAG}}
- -X github.com/sky-uk/umc-shared/vergo/cmd.commit={{.Commit}}
- -X github.com/sky-uk/umc-shared/vergo/cmd.date={{.Date}}
- -X github.com/sky-uk/umc-shared/vergo/cmd.snapshot={{.IsSnapshot}}
- -X "github.com/sky-uk/umc-shared/vergo/cmd.builtBy={{.Env.BUILT_BY}}"
- -X github.com/sky-uk/vergo/cmd.version={{.Env.GORELEASER_CURRENT_TAG}}
- -X github.com/sky-uk/vergo/cmd.commit={{.Commit}}
- -X github.com/sky-uk/vergo/cmd.date={{.Date}}
- -X github.com/sky-uk/vergo/cmd.snapshot={{.IsSnapshot}}
- -X "github.com/sky-uk/vergo/cmd.builtBy={{.Env.BUILT_BY}}"

snapshot:
name_template: "{{ .Env.GORELEASER_CURRENT_TAG }}"
Expand All @@ -40,11 +40,3 @@ archives:
source:
name_template: '{{ .ProjectName }}-{{ .Tag }}'
format: tar.gz

uploads:
# You can have multiple Put instances.
- # Unique name of your Put instance. Used to identify the instance.
name: nexus
method: PUT
mode: archive
target: '{{ .Env.UPLOAD_TARGET }}/{{ .ProjectName }}/{{ .Tag }}/'
22 changes: 22 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
os: linux
dist: xenial
language: go

go:
- 1.17.x

before_install:
- git fetch --tags

cache:
directories: []

before_cache: []

jobs:
include:
- name: build
script: make release-test check-licenses test
- stage: release
if: (branch = master AND type = push) AND NOT fork
script: make release
54 changes: 46 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,53 @@
# Contributing

## Requirements
Contributions are welcomed!

* go v1.15+
* goreleaser
* gofmt
When contributing to this repository, please first discuss the change you wish to make via GitHub
issue before making a change. This saves everyone from wasted effort in the event that the proposed
changes need some adjustment before they are ready for submission.

## Testing
## Pull Request Process

Run `make test` from the vergo directory.
1. If your changes include multiple commits, please squash them into a single commit. Stack Overflow
and various blogs can help with this process if you're not already familiar with it.
2. Make sure to commit changes to vendor, ideally as a separate commit to any other code change.
3. Update the README.md where relevant.
4. You may merge the Pull Request in once you have the sign-off, or if you do not have permission to
do that, you may request the reviewer to merge it for you.

## Changelog
## Contributor Code of Conduct

Please ensure you update the `CHANGELOG.md`.
As contributors and maintainers of this project, and in the interest of fostering an open and
welcoming community, we pledge to respect all people who contribute through reporting issues,
posting feature requests, updating documentation, submitting pull requests or patches, and other
activities.

We are committed to making participation in this project a harassment-free experience for everyone,
regardless of level of experience, gender, gender identity and expression, sexual orientation,
disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic addresses, without explicit
permission
* Other unethical or unprofessional conduct.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits,
code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By
adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently
applying these principles to every aspect of managing this project. Project maintainers who do not
follow or enforce the Code of Conduct may be permanently removed from the project team.

This code of conduct applies both within project spaces and in public spaces when an individual is
representing the project or its community.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an
issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org),
version 1.2.0, available at
[http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
24 changes: 16 additions & 8 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export

GORELEASER_VERSION := 0.179.0
LINTER_VERSION := 1.43.0
UPLOAD_TARGET=https://nexus.api.bskyb.com/nexus/content/repositories/nova-packages
PATH := $(shell pwd)/bin:$(PATH)
SHELL := bash

Expand Down Expand Up @@ -46,16 +45,16 @@ pre-check: tools
golangci-lint run ./...

release-test: build
bin/vergo check increment-hint --tag-prefix vergo
bin/vergo check increment-hint

release: build
bin/vergo check release --tag-prefix vergo || exit 0
bin/vergo bump auto --tag-prefix vergo
bin/vergo check release || exit 0
bin/vergo bump auto
BUILT_BY="`goreleaser --version | head -n1`, `go version`" \
GORELEASER_CURRENT_TAG=`bin/vergo get latest-release --tag-prefix vergo -p` \
GORELEASER_PREVIOUS_TAG=`bin/vergo get previous-release --tag-prefix vergo -p` \
goreleaser release --skip-validate --rm-dist
bin/vergo push --tag-prefix vergo
GORELEASER_CURRENT_TAG=`bin/vergo get latest-release -p` \
GORELEASER_PREVIOUS_TAG=`bin/vergo get previous-release -p` \
goreleaser release --rm-dist
#bin/vergo push

unit-tests: pre-check
go clean -testcache
Expand All @@ -80,3 +79,12 @@ build: pre-check

dependency-updates:
@go list -u -f '{{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}: {{.Version}} -> {{.Update.Version}}{{end}}' -m all

go-licenses:
@go install github.com/google/go-licenses@latest

print-licenses: go-licenses
@go-licenses csv .

check-licenses: go-licenses
!(go-licenses csv . | grep -E 'GNU|AGPL|GPL|MPL|CPL|CDDL|EPL|CCBYNC|Facebook|WTFPL')
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2022, Sky UK Ltd
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 changes: 20 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,36 @@
Vergo is an executable command line tool that is an alternative to axion gradle plugin
(https://github.com/allegro/axion-release-plugin.git)

## Requirements

* go v1.17+
* goreleaser
* gofmt

## Testing

Run `make test` from the vergo directory.

## Changelog

Please ensure you update the `CHANGELOG.md`.

## Installation

### Mac

```bash
curl -sLo vergo_vergo-0.20.0_darwin_amd64.tar.gz https://nexus.api.bskyb.com/nexus/service/local/repositories/nova-packages/content/vergo/vergo-0.20.0/vergo_vergo-0.20.0_darwin_amd64.tar.gz \
&& tar -xzf vergo_vergo-0.20.0_darwin_amd64.tar.gz -C /usr/local/bin \
&& rm vergo_vergo-0.20.0_darwin_amd64.tar.gz
curl -sLo vergo_0.20.0_darwin_arm64.tar.gz https://github.com/sky-uk/vergo/releases/download/v0.20.0/vergo_0.20.0_darwin_arm64.tar.gz \
&& tar -xzf vergo_0.20.0_darwin_arm64.tar.gz -C /usr/local/bin \
&& rm vergo_0.20.0_darwin_arm64.tar.gz
```

### Linux

```bash
curl -sLo vergo_vergo-0.20.0_linux_amd64.tar.gz https://nexus.api.bskyb.com/nexus/service/local/repositories/nova-packages/content/vergo/vergo-0.20.0/vergo_vergo-0.20.0_linux_amd64.tar.gz \
&& tar -xzf vergo_vergo-0.20.0_linux_amd64.tar.gz -C /usr/local/bin \
&& rm vergo_vergo-0.20.0_linux_amd64.tar.gz
curl -sLo vergo_0.20.0_linux_arm64.tar.gz https://github.com/sky-uk/vergo/releases/download/v0.20.0/vergo_0.20.0_linux_arm64.tar.gz \
&& tar -xzf vergo_0.20.0_linux_arm64.tar.gz -C /usr/local/bin \
&& rm vergo_0.20.0_linux_arm64.tar.gz
```


Expand Down Expand Up @@ -140,6 +154,3 @@ INFO[0000] Set tag project-0.1.2
0.1.2
```

* There is no replacement for `markNextVersion` at the moment. happy to implement this if it is required by other teams.
Nova don't use it.
4 changes: 2 additions & 2 deletions bump/bump.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
gogit "github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
log "github.com/sirupsen/logrus"
"github.com/sky-uk/umc-shared/vergo/git"
"github.com/sky-uk/umc-shared/vergo/release"
"github.com/sky-uk/vergo/git"
"github.com/sky-uk/vergo/release"
"strings"
)

Expand Down
6 changes: 3 additions & 3 deletions bump/bump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/go-git/go-git/v5/storage/memory"
. "github.com/sky-uk/umc-shared/vergo/bump"
. "github.com/sky-uk/umc-shared/vergo/git"
. "github.com/sky-uk/umc-shared/vergo/internal-test"
. "github.com/sky-uk/vergo/bump"
. "github.com/sky-uk/vergo/git"
. "github.com/sky-uk/vergo/internal-test"
"github.com/stretchr/testify/assert"
"testing"
"time"
Expand Down
3 changes: 0 additions & 3 deletions cd-scripts/cdBuild.sh

This file was deleted.

3 changes: 0 additions & 3 deletions cd-scripts/cdRelease.sh

This file was deleted.

6 changes: 3 additions & 3 deletions cmd/cmd_bump.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package cmd
import (
"github.com/go-git/go-git/v5"
log "github.com/sirupsen/logrus"
"github.com/sky-uk/umc-shared/vergo/bump"
vergo "github.com/sky-uk/umc-shared/vergo/git"
"github.com/sky-uk/umc-shared/vergo/release"
"github.com/sky-uk/vergo/bump"
vergo "github.com/sky-uk/vergo/git"
"github.com/sky-uk/vergo/release"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/cmd_bump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package cmd_test

import (
"fmt"
"github.com/sky-uk/umc-shared/vergo/bump"
. "github.com/sky-uk/umc-shared/vergo/internal-test"
"github.com/sky-uk/vergo/bump"
. "github.com/sky-uk/vergo/internal-test"
"github.com/stretchr/testify/assert"
"os"
"testing"
Expand Down
2 changes: 1 addition & 1 deletion cmd/cmd_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"errors"
"github.com/go-git/go-git/v5"
"github.com/sky-uk/umc-shared/vergo/release"
"github.com/sky-uk/vergo/release"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/cmd_check_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package cmd_test

import (
. "github.com/sky-uk/umc-shared/vergo/internal-test"
"github.com/sky-uk/umc-shared/vergo/release"
. "github.com/sky-uk/vergo/internal-test"
"github.com/sky-uk/vergo/release"
"github.com/stretchr/testify/assert"
"testing"
)
Expand Down
10 changes: 5 additions & 5 deletions cmd/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"errors"
"github.com/Masterminds/semver/v3"
"github.com/go-git/go-git/v5"
"github.com/sky-uk/umc-shared/vergo/bump"
. "github.com/sky-uk/umc-shared/vergo/cmd"
vergo "github.com/sky-uk/umc-shared/vergo/git"
. "github.com/sky-uk/umc-shared/vergo/internal-test"
"github.com/sky-uk/umc-shared/vergo/release"
"github.com/sky-uk/vergo/bump"
. "github.com/sky-uk/vergo/cmd"
vergo "github.com/sky-uk/vergo/git"
. "github.com/sky-uk/vergo/internal-test"
"github.com/sky-uk/vergo/release"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
"io/ioutil"
Expand Down
4 changes: 2 additions & 2 deletions cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/Masterminds/semver/v3"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
vergo "github.com/sky-uk/umc-shared/vergo/git"
"github.com/sky-uk/umc-shared/vergo/release"
vergo "github.com/sky-uk/vergo/git"
"github.com/sky-uk/vergo/release"
"github.com/spf13/cobra"
"github.com/thoas/go-funk"
)
Expand Down
6 changes: 3 additions & 3 deletions cmd/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package cmd_test
import (
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
vergo "github.com/sky-uk/umc-shared/vergo/git"
. "github.com/sky-uk/umc-shared/vergo/internal-test"
"github.com/sky-uk/umc-shared/vergo/release"
vergo "github.com/sky-uk/vergo/git"
. "github.com/sky-uk/vergo/internal-test"
"github.com/sky-uk/vergo/release"
"github.com/stretchr/testify/assert"
"os"
"testing"
Expand Down
2 changes: 1 addition & 1 deletion cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cmd

import (
"github.com/go-git/go-git/v5"
vergo "github.com/sky-uk/umc-shared/vergo/git"
vergo "github.com/sky-uk/vergo/git"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/list_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd_test

import (
. "github.com/sky-uk/umc-shared/vergo/internal-test"
. "github.com/sky-uk/vergo/internal-test"
"github.com/stretchr/testify/assert"
"os"
"testing"
Expand Down
2 changes: 1 addition & 1 deletion cmd/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cmd

import (
"github.com/go-git/go-git/v5"
vergo "github.com/sky-uk/umc-shared/vergo/git"
vergo "github.com/sky-uk/vergo/git"
"github.com/spf13/cobra"
)

Expand Down
Loading

0 comments on commit 44f1582

Please sign in to comment.