From 86430852b08c882bc3155692fdc2ef8625ac0bc0 Mon Sep 17 00:00:00 2001 From: Shu Shen Date: Mon, 18 Jan 2021 15:26:54 -0800 Subject: [PATCH] chore: addtional make targets for build and ci --- .github/workflows/go.yml | 7 ++----- Makefile | 22 +++++++++++++++++++++- README.md | 14 +++++++++++--- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 0a3ec7a0f..7d466c5a1 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -18,8 +18,5 @@ jobs: - name: Install golanglint-ci run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.6 - - name: Lint - run: PATH=$(go env GOPATH)/bin:$PATH make lint - - - name: Test - run: make test + - name: ci + run: PATH=$(go env GOPATH)/bin:$PATH make ci diff --git a/Makefile b/Makefile index e302753fc..7dba90ac4 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,28 @@ test: CGO_ENABLED=1 go test -race ./... -count 1 +.PHONY: test lint: golangci-lint run -v --timeout=5m +.PHONY: lint -.PHONY: test lint +# Build for the native platform +build: + go build -o auth0 cmd/auth0/main.go +.PHONY: build + +# Build for the native platform +build: +.PHONY: build + +# Build a beta version of stripe for all supported platforms +build-all-platforms: + env GOOS=darwin go build -o auth0-darwin cmd/auth0/main.go + env GOOS=linux go build -o auth0-linux cmd/auth0/main.go + env GOOS=windows go build -o auth0-windows.exe cmd/auth0/main.go +.PHONY: build-all-platforms + +# Run all the tests and code checks +ci: build-all-platforms test lint +.PHONY: ci diff --git a/README.md b/README.md index bc07c4676..6aa32ed71 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,17 @@ Stripe CLI, etc. ## Setup instructions 1. [Setup go](https://golang.org/doc/install) -2. Clone this repo (git clone git@github.com:auth0/auth0-cli +2. Clone this repo: `git clone git@github.com:auth0/auth0-cli` 3. `make test` - ensure everything works correctly. Should see things pass. +## Build and run on native platform + +From the top-level directory: +``` +$ make build +$ ./auth0 --help +``` + ## Adding a new command This part is not fully fleshed out yet, but here are the steps: @@ -35,12 +43,12 @@ go run ./cmd/auth0 If you have to add another go dependency, you can follow the steps: 1. `go get -u github.com/some/path/to/lib` -2. Import the library you need in the relevant file. (This step is necessary so +2. Import the library you need in the relevant file. (This step is necessary, so the next steps informs `go mod` that this dependency is actually used). 3. go mod tidy 4. go mod vendor -We use vendoring so the last step is required. +We use vendoring, so the last step is required. ## References