Update Makefile and add git pre-push hook (#1382)
This commit is contained in:
@@ -11,36 +11,38 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
.PHONY: test
|
|
||||||
.DEFAULT_GOAL := build
|
|
||||||
|
|
||||||
IMAGE ?= fission/fission-bundle
|
.DEFAULT_GOAL := check
|
||||||
VERSION ?= latest
|
|
||||||
ARCH ?= amd64
|
|
||||||
OS ?= linux
|
|
||||||
|
|
||||||
test:
|
check: test-run build clean
|
||||||
go test -v $(go list ./... | grep -v /examples/ | grep -v /environments/)
|
|
||||||
|
|
||||||
build: build-bundle build-client
|
# run basic check scripts
|
||||||
|
test-run:
|
||||||
|
hack/verify-gofmt.sh
|
||||||
|
hack/verify-govet.sh
|
||||||
|
hack/verify-staticcheck.sh
|
||||||
|
hack/runtests.sh
|
||||||
|
@rm -f coverage.txt
|
||||||
|
|
||||||
build-client:
|
# ensure the changes are buildable
|
||||||
|
build:
|
||||||
|
go build -o cmd/fission-bundle/fission-bundle ./cmd/fission-bundle/
|
||||||
go build -o cmd/fission-cli/fission ./cmd/fission-cli/
|
go build -o cmd/fission-cli/fission ./cmd/fission-cli/
|
||||||
|
go build -o cmd/fetcher/fetcher ./cmd/fetcher/
|
||||||
|
go build -o cmd/fetcher/builder ./cmd/builder/
|
||||||
|
|
||||||
build-bundle:
|
# install CLI binary to $PATH
|
||||||
CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o cmd/fission-bundle/fission-bundle ./cmd/fission-bundle/
|
install: build
|
||||||
|
mv cmd/fission-cli/fission $(GOPATH)/bin
|
||||||
|
|
||||||
build-image:
|
# build images (environment images are not included)
|
||||||
docker build --rm --tag "$(IMAGE):$(VERSION)" cmd/fission-bundle/
|
image:
|
||||||
|
docker build -t fission-bundle -f cmd/fission-bundle/Dockerfile.fission-bundle .
|
||||||
install:
|
docker build -t fetcher -f cmd/fetcher/Dockerfile.fission-fetcher .
|
||||||
go install ./cmd/fission-cli/
|
docker build -t builder -f cmd/builder/Dockerfile.fission-builder .
|
||||||
|
|
||||||
image: build-bundle build-image
|
|
||||||
|
|
||||||
image-push: image
|
|
||||||
docker push "$(IMAGE):$(VERSION)"
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -f fission-bundle/fission-bundle
|
@rm -f cmd/fission-bundle/fission-bundle
|
||||||
@rm -f fission/fission
|
@rm -f cmd/fission-cli/fission
|
||||||
|
@rm -f cmd/fetcher/fetcher
|
||||||
|
@rm -f cmd/fetcher/builder
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# Git hooks
|
||||||
|
|
||||||
|
* pre-push: Check, build and test the changes.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cp githooks/* .git/hooks/
|
||||||
|
```
|
||||||
Executable
+6
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ROOT=`realpath $(dirname $0)/../..`
|
||||||
|
pushd $ROOT
|
||||||
|
make
|
||||||
|
popd
|
||||||
@@ -4,4 +4,4 @@ set -o errexit
|
|||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
go vet -v $(go list ./...| grep -v vendor)
|
go vet -v $(go list ./...| grep -v "vendor" | grep -v "examples" | grep -v "demos" | grep -v "test")
|
||||||
|
|||||||
@@ -4,6 +4,4 @@ set -o errexit
|
|||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
ROOT=`realpath $(dirname $0)/..`
|
go list ./...| grep -v vendor | grep -v "examples" | grep -v "demos" | grep -v "test" | xargs -I@ staticcheck @
|
||||||
|
|
||||||
go list ./...| grep -v vendor | grep -v "examples" | grep -v "demos" | xargs -I@ staticcheck @
|
|
||||||
|
|||||||
Reference in New Issue
Block a user