Skip to content

Commit

Permalink
chore: update build instructions and mockgen version (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Aug 11, 2024
1 parent 8f12f09 commit 181ee63
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
go-version: ${{matrix.goversion}}
- name: Build
run: |
go install github.com/golang/mock/mockgen@v1.4.3
go install go.uber.org/mock/mockgen@v0.4.0
ARTIFACT_DESTINATION=./builds make build
# - name: Check version
# run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lagoon-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
go-version: ${{matrix.goversion}}
- name: Build
run: |
go install github.com/golang/mock/mockgen@v1.4.3
go install go.uber.org/mock/mockgen@v0.4.0
ARTIFACT_DESTINATION=./builds make build
# - name: Check version
# run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
go-version: 1.21
- name: Build CLI
run: |
go install github.com/golang/mock/mockgen@v1.4.3
go install go.uber.org/mock/mockgen@v0.4.0
make deps
make test
- name: Compile CLI
Expand Down
19 changes: 2 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ build-linux: test
GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOCMD) build -ldflags '${LDFLAGS} -X "${PKG}/cmd.lagoonCLIBuildGoVersion=${GO_VER}"' -o builds/lagoon-cli-${VERSION}-linux-amd64 -v
build-darwin: test
GO111MODULE=on CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GOCMD) build -ldflags '${LDFLAGS} -X "${PKG}/cmd.lagoonCLIBuildGoVersion=${GO_VER}"' -o builds/lagoon-cli-${VERSION}-darwin-amd64 -v
build-darwin-arm64: test
GO111MODULE=on CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 $(GOCMD) build -ldflags '${LDFLAGS} -X "${PKG}/cmd.lagoonCLIBuildGoVersion=${GO_VER}"' -o builds/lagoon-cli-${VERSION}-darwin-arm64 -v

docs: test
LAGOON_GEN_DOCS=true GO111MODULE=on $(GOCMD) run main.go --docs
Expand Down Expand Up @@ -96,20 +98,3 @@ install-linux:
install-darwin:
cp builds/lagoon-cli-${VERSION}-darwin-amd64 ${ARTIFACT_DESTINATION}/lagoon

release-patch:
$(eval VERSION=$(shell ${PWD}/increment_ver.sh -p $(shell git describe --abbrev=0 --tags)))
git tag $(VERSION)
mkdocs gh-deploy
git push $(GIT_ORIGIN) main --tags

release-minor:
$(eval VERSION=$(shell ${PWD}/increment_ver.sh -m $(shell git describe --abbrev=0 --tags)))
git tag $(VERSION)
mkdocs gh-deploy
git push $(GIT_ORIGIN) main --tags

release-major:
$(eval VERSION=$(shell ${PWD}/increment_ver.sh -M $(shell git describe --abbrev=0 --tags)))
git tag $(VERSION)
mkdocs gh-deploy
git push $(GIT_ORIGIN) main --tags
36 changes: 22 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,38 @@ lagoon <command>
### Commands
For the full list of commands see the docs for [Lagoon CLI](https://uselagoon.github.io/lagoon-cli/commands/lagoon/)

## Build
## Building

Note: You should make sure you have your `GOPATH` configured and in your path if you are going to build the lagoon CLI. If you haven't got `go` installed and are using the docker method, you can export `GOPATH` to be somewhere else in your `PATH` for binaries.
### Requirements

Install `Go` - https://go.dev/doc/install

You also need `mockgen`, it can be installed using the following command once `Go` is installed.

```
go install go.uber.org/mock/[email protected]
```

Note: You should make sure you have your `GOPATH` configured and in your path, see https://pkg.go.dev/cmd/go#hdr-GOPATH_environment_variable

### Run tests
```
make test
make test-docker
```

### Build locally

You can compile the binary and load it into your `GOPATH` bin directory using the following.
```
make build
```

Alternatively, these will compile a binary inside a `builds` directory in this repository, you can place them wherever you wish.
```
make build-linux
make build-darwin #macos
#macos
make build-darwin
make build-darwin-arm64
```

### Build using Docker
Expand All @@ -57,14 +75,6 @@ make all-docker-linux
make all-docker-darwin
```

### Releasing
New releases can be created by running one of the following, this will create the version bump and update the `gh-pages` branch
```
make release-patch
make release-minor
make release-major
```

### Install
```
make ARTIFACT_DESTINATION=/usr/local/bin install-linux
Expand All @@ -77,8 +87,6 @@ Versions can also be defined, and the binaries will be version tagged
make VERSION=v0.0.1 ...
```



### Acknowledgements

[Matt Glaman](https://github.com/mglaman) - Initial conception and development - Thanks Matt!
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
go.uber.org/mock v0.4.0 // indirect
golang.org/x/sys v0.18.0 // indirect
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
github.com/uselagoon/machinery v0.0.27 h1:luIrdAiVhCPgxAwh2gtPm5iepMnXyTR6sNbuLuBhk80=
github.com/uselagoon/machinery v0.0.27/go.mod h1:NbgtEofjK2XY0iUpk9aMYazIo+W/NI56+UF72jv8zVY=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
Expand Down
2 changes: 1 addition & 1 deletion internal/lagoon/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"os"
"testing"

"github.com/golang/mock/gomock"
"github.com/uselagoon/lagoon-cli/internal/lagoon"
"github.com/uselagoon/lagoon-cli/internal/mock"
"github.com/uselagoon/lagoon-cli/internal/schema"
api "github.com/uselagoon/machinery/api/schema"
"go.uber.org/mock/gomock"
)

// importCalls stores arrays of expected import calls associated with a given
Expand Down
37 changes: 21 additions & 16 deletions internal/mock/mock_importer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 181ee63

Please sign in to comment.