github.com/smartcontractkit/chainlink-testing-framework/libs@v0.0.0-20240227141906-ec710b4eb1a3/Makefile (about) 1 BIN_DIR = bin 2 export GOPATH ?= $(shell go env GOPATH) 3 export GO111MODULE ?= on 4 CDK8S_CLI_VERSION=2.1.48 5 6 LINUX=LINUX 7 OSX=OSX 8 WINDOWS=WIN32 9 OSFLAG := 10 ifeq ($(OS),Windows_NT) 11 OSFLAG = $(WINDOWS) 12 else 13 UNAME_S := $(shell uname -s) 14 ifeq ($(UNAME_S),Linux) 15 OSFLAG = $(LINUX) 16 endif 17 ifeq ($(UNAME_S),Darwin) 18 OSFLAG = $(OSX) 19 endif 20 endif 21 22 lint: 23 golangci-lint --color=always run ./... --fix -v 24 25 go_mod: 26 go mod tidy 27 go mod download 28 29 .PHONY: install_gotestfmt 30 install_gotestfmt: 31 go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest 32 set -euo pipefail 33 34 install_tools: 35 ifeq ($(OSFLAG),$(WINDOWS)) 36 echo "If you are running windows and know how to install what is needed, please contribute by adding it here!" 37 exit 1 38 endif 39 ifeq ($(OSFLAG),$(OSX)) 40 brew install asdf 41 asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs.git || true 42 asdf plugin-add golang https://github.com/kennyp/asdf-golang.git || true 43 asdf plugin add k3d https://github.com/spencergilbert/asdf-k3d.git || true 44 asdf plugin add act https://github.com/grimoh/asdf-act.git || true 45 asdf plugin add golangci-lint https://github.com/hypnoglow/asdf-golangci-lint.git || true 46 asdf plugin add actionlint || true 47 asdf plugin add shellcheck || true 48 asdf plugin-add yarn || true 49 asdf plugin-add k3d || true 50 asdf plugin-add helm || true 51 asdf plugin-add kubectl || true 52 asdf plugin-add python || true 53 asdf plugin add pre-commit || true 54 asdf install 55 mkdir /tmp/k3dvolume/ || true 56 yarn global add cdk8s-cli@$(CDK8S_CLI_VERSION) 57 curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash 58 helm repo add chainlink-qa https://raw.githubusercontent.com/smartcontractkit/qa-charts/gh-pages/ 59 helm repo add grafana https://grafana.github.io/helm-charts 60 helm repo update 61 pre-commit install 62 endif 63 64 install: go_mod install_tools 65 66 install_ci: go_mod install_tools 67 68 docker_prune: 69 docker system prune -a -f 70 docker volume prune -f 71 72 compile_contracts: 73 python3 ./utils/compile_contracts.py 74 75 test_unit: install_gotestfmt 76 go test -json -cover -covermode=count -coverprofile=unit-test-coverage.out ./client ./gauntlet ./testreporters ./k8s/config ./utils/osutil 2 2>&1 | tee /tmp/gotest.log | gotestfmt 77 78 test_docker: install_gotestfmt 79 go test -json -cover -covermode=count -coverprofile=unit-test-coverage.out ./docker/test_env ./logstream 2>&1 | tee /tmp/gotest.log | gotestfmt 80 81 82 ####################### 83 # K8s Helpers 84 ####################### 85 .PHONY: create_cluster 86 create_cluster: 87 k3d cluster create local --config ./k8s/k3d.yaml 88 89 .PHONY: start_cluster 90 start_cluster: 91 k3d cluster start local 92 93 .PHONY: stop_cluster 94 stop_cluster: 95 k3d cluster stop local 96 97 .PHONY: stop_cluster 98 delete_cluster: 99 k3d cluster delete local 100 101 .PHONY: install_monitoring 102 install_monitoring: 103 helm repo add grafana https://grafana.github.io/helm-charts 104 helm repo update 105 kubectl create namespace monitoring || true 106 helm upgrade --wait --namespace monitoring --install loki grafana/loki-stack --set grafana.enabled=true,prometheus.enabled=true,prometheus.alertmanager.persistentVolume.enabled=false,prometheus.server.persistentVolume.enabled=false,loki.persistence.enabled=false --values k8s/grafana/values.yml 107 kubectl port-forward --namespace monitoring service/loki-grafana 3000:80 108 109 .PHONY: uninstall_monitoring 110 uninstall_monitoring: 111 helm uninstall --namespace monitoring loki 112 113 .PHONY: build_test_base_image 114 build_k8s_test_base_image: 115 ./k8s/scripts/buildBaseImage "$(tag)" 116 117 .PHONY: build_test_image 118 build_k8s_test_image: 119 ./k8s/scripts/buildTestImage "$(tag)" "$(base_tag)" 120 121 k8s_test: 122 go test -race ./k8s/config -count 1 -v 123 124 k8s_test_e2e: 125 go test ./k8s/e2e/local-runner -count 1 -test.parallel=12 -v $(args) 126 127 k8s_test_e2e_ci: 128 go test ./k8s/e2e/local-runner -count 1 -v -test.parallel=14 -test.timeout=1h -json 2>&1 | tee /tmp/gotest.log | gotestfmt 129 130 k8s_test_e2e_ci_remote_runner: 131 go test ./k8s/e2e/remote-runner -count 1 -v -test.parallel=20 -test.timeout=1h -json 2>&1 | tee /tmp/remoterunnergotest.log | gotestfmt 132 133 .PHONY: examples 134 examples: 135 go run k8s/cmd/test.go 136 137 .PHONY: chaosmesh 138 chaosmesh: ## there is currently a bug on JS side to import all CRDs from one yaml file, also a bug with stdin, so using cluster directly trough file 139 kubectl get crd networkchaos.chaos-mesh.org -o json > tmp.json && cdk8s import -o k8s/imports/k8s/networkchaos tmp.json 140 kubectl get crd stresschaos.chaos-mesh.org -o json > tmp.json && cdk8s import -o k8s/imports/k8s/stresschaos tmp.json 141 kubectl get crd timechaos.chaos-mesh.org -o json > tmp.json && cdk8s import -o k8s/imports/k8s/timechaos tmp.json 142 kubectl get crd podchaos.chaos-mesh.org -o json > tmp.json && cdk8s import -o k8s/imports/k8s/podchaos tmp.json 143 kubectl get crd podiochaos.chaos-mesh.org -o json > tmp.json && cdk8s import -o k8s/imports/k8s/podiochaos tmp.json 144 kubectl get crd httpchaos.chaos-mesh.org -o json > tmp.json && cdk8s import -o k8s/imports/k8s/httpchaos tmp.json 145 kubectl get crd iochaos.chaos-mesh.org -o json > tmp.json && cdk8s import -o k8s/imports/k8s/iochaos tmp.json 146 kubectl get crd podnetworkchaos.chaos-mesh.org -o json > tmp.json && cdk8s import -o k8s/imports/k8s/podnetworkchaos tmp.json 147 rm -rf tmp.json