From 3b93268d4b2ea1e98263b0329a3b21bed5a03ef1 Mon Sep 17 00:00:00 2001 From: Dario Maiocchi Date: Sat, 11 Nov 2017 13:16:03 +0100 Subject: Add more doc about the Makefile workflow(suggested) --- GNUmakefile | 22 ---------------------- Makefile | 25 +++++++++++++++++++++++++ doc/CONTRIBUTING.md | 19 +++++++++++++++---- tests/run_acceptance_test.sh | 8 -------- travis/run_acceptance_test.sh | 8 ++++++++ 5 files changed, 48 insertions(+), 34 deletions(-) delete mode 100644 GNUmakefile create mode 100644 Makefile delete mode 100755 tests/run_acceptance_test.sh create mode 100755 travis/run_acceptance_test.sh diff --git a/GNUmakefile b/GNUmakefile deleted file mode 100644 index f5c3f4e2..00000000 --- a/GNUmakefile +++ /dev/null @@ -1,22 +0,0 @@ -default: build - -build: gofmtcheck - go install - -testacc: build - bash tests/run_acceptance_test.sh -vet: - @echo "go vet ." - @go vet $$(go list ./... | grep -v vendor/) ; if [ $$? -eq 1 ]; then \ - echo ""; \ - echo "Vet found suspicious constructs. Please check the reported constructs"; \ - echo "and fix them if necessary before submitting the code for review."; \ - exit 1; \ - fi - -golint: - golint ./libvirt -gofmtcheck: - bash travis/gofmtcheck.sh - -.PHONY: build testacc vet fmt golint diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..a2adfead --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +default: build + +build: gofmtcheck + go build + +install: build + go install + +test: install + bash travis/run_acceptance_test.sh +vet: + @echo "go vet ." + @go vet $$(go list ./... | grep -v vendor/) ; if [ $$? -eq 1 ]; then \ + echo ""; \ + echo "Vet found suspicious constructs. Please check the reported constructs"; \ + echo "and fix them if necessary before submitting the code for review."; \ + exit 1; \ + fi + +golint: + golint ./libvirt +gofmtcheck: + bash travis/gofmtcheck.sh + +.PHONY: build install test vet fmt golint diff --git a/doc/CONTRIBUTING.md b/doc/CONTRIBUTING.md index bbdfe7af..6fbcf4c8 100644 --- a/doc/CONTRIBUTING.md +++ b/doc/CONTRIBUTING.md @@ -5,15 +5,26 @@ Look at open issues, especially with label: - [junior job](https://github.com/dmacvicar/terraform-provider-libvirt/issues?q=is%3Aissue+is%3Aopen+label%3A%22junior+job%22), - [help wanted](https://github.com/dmacvicar/terraform-provider-libvirt/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) +### Makefile devel workflow. + +Go in your build dir ```cd $GOPATH/src/github.com/dmacvicar/terraform-provider-libvirt```, +then use + +```console +make test +``` + # Contribute -1. [Build the plugin from source](https://github.com/dmacvicar/terraform-provider-libvirt#building-from-source) -2. If you have issues, check out the [troubleshooting](https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/doc/TROUBLESHOOTING.md) -3. Do your code (reference issue on your pr if you fix them) [Closing issues keywords](https://help.github.com/articles/closing-issues-using-keywords/) -4. Run the acceptance tests. +1. If you have issues, check out the [troubleshooting](https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/doc/TROUBLESHOOTING.md) +2. Do your code (reference issue on your pr if you fix them) [Closing issues keywords](https://help.github.com/articles/closing-issues-using-keywords/) +3. Use the Makefile workflow before submit the PR (building, tests). +4. Test your code by running the acceptance tests ```make test``` +5. Create a PR ## Writing acceptance tests. +Look at https://github.com/hashicorp/terraform/blob/master/.github/CONTRIBUTING.md#running-an-acceptance-test ## Running acceptance tests diff --git a/tests/run_acceptance_test.sh b/tests/run_acceptance_test.sh deleted file mode 100755 index 5010505a..00000000 --- a/tests/run_acceptance_test.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -x - -unset http_proxy -export TERRAFORM_LIBVIRT_TEST_DOMAIN_TYPE=qemu -export LIBVIRT_DEFAULT_URI="qemu:///system" -export TF_ACC=true -go test -v -covermode=count -coverprofile=profile.cov -timeout=1200s ./libvirt diff --git a/travis/run_acceptance_test.sh b/travis/run_acceptance_test.sh new file mode 100755 index 00000000..5010505a --- /dev/null +++ b/travis/run_acceptance_test.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -x + +unset http_proxy +export TERRAFORM_LIBVIRT_TEST_DOMAIN_TYPE=qemu +export LIBVIRT_DEFAULT_URI="qemu:///system" +export TF_ACC=true +go test -v -covermode=count -coverprofile=profile.cov -timeout=1200s ./libvirt -- cgit v1.2.3