Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Create Makefile #330

Merged
merged 6 commits into from
Dec 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
export CQ_PROVIDER_DEBUG=1
export CQ_REATTACH_PROVIDERS=.cq_reattach

# install the latest version of CQ
install-cq:
@if [[ "$(OS)" != "Darwin" && "$(OS)" != "Linux" && "$(OS)" != "Windows" ]]; then echo "\n Invalid OS set. Valid Options are Darwin, Linux and Windows. Example invocation is:\n make OS=Linux ARCH=arm64 install-cq \n For more information go to https://docs.cloudquery.io/docs/getting-started \n"; exit 1; fi
@if [[ "$(ARCH)" != "x86_64" && "$(ARCH)" != "arm64" ]]; then echo "\n Invalid ARCH set. Valid options are x86_64 and arm64. Example invocation is:\n make OS=Linux ARCH=arm64 install-cq \n For more information go to https://docs.cloudquery.io/docs/getting-started \n"; exit 1; fi
curl -L https://github.com/cloudquery/cloudquery/releases/latest/download/cloudquery_${OS}_${ARCH} -o cloudquery
chmod a+x cloudquery


# build the cq aws provider
build:
go build -o cq-provider-aws

# build and run the cq aws provider
run: build
roneli marked this conversation as resolved.
Show resolved Hide resolved
./cq-provider-aws

# start a running docker container
start-pg:
docker run -p 5432:5432 -e POSTGRES_PASSWORD=pass -d postgres

# stop a running docker container
stop-pg:
docker stop $$(docker ps -q --filter ancestor=postgres:latest)

# connect to pg via cli
pg-connect:
psql -h localhost -p 5432 -U postgres -d postgres



# Run an integration test
# you can pass in a specific test to run by specifying the testName:
# make testName=TestIntegrationElasticbeanstal e2e-test
e2e-test:
INTEGRATION_TESTS=1 TF_VAR_PREFIX=cq-testing TF_APPLY_RESOURCES=0 TF_VAR_SUFFIX=integration go test -timeout 30s -v -run ^$(testName)$$ github.com/cloudquery/cq-provider-aws/resources/integration_tests

# Generate mocks for mock/unit testing
create-mocks:
go install github.com/golang/mock/mockgen
$(shell PATH=$$PATH:$$(go env GOPATH)/bin && go generate client/services.go)

# Run a fetch command
fetch:
./cloudquery fetch --dsn "postgres://postgres:pass@localhost:5432/postgres?sslmode=disable" -v