-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
267 changed files
with
281 additions
and
33,275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,24 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master, main ] | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.20.2 | ||
go-version: 1.21.3 | ||
|
||
- name: Linters | ||
run: make linters | ||
run: make lint | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
|
||
- name: Tests data_source | ||
env: | ||
EC_USERNAME: ${{ secrets.EC_USERNAME }} | ||
EC_PASSWORD: ${{ secrets.EC_PASSWORD }} | ||
run: make test_cloud_data_source | ||
|
||
- name: Tests resource | ||
env: | ||
EC_USERNAME: ${{ secrets.EC_USERNAME }} | ||
EC_PASSWORD: ${{ secrets.EC_PASSWORD }} | ||
run: make test_cloud_resource | ||
- name: Tests | ||
run: make test |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,13 @@ | ||
# Visit https://goreleaser.com for documentation on how to customize this | ||
# behavior. | ||
before: | ||
hooks: | ||
# this is just an example and not a requirement for provider building/publishing | ||
- go mod tidy | ||
builds: | ||
- env: | ||
# goreleaser does not work with CGO, it could also complicate | ||
# usage by users in CI/CD systems like Terraform Cloud where | ||
# they are unable to install libraries. | ||
- CGO_ENABLED=0 | ||
mod_timestamp: '{{ .CommitTimestamp }}' | ||
flags: | ||
- -trimpath | ||
ldflags: | ||
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}' | ||
goos: | ||
- freebsd | ||
- windows | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- '386' | ||
- arm | ||
- arm64 | ||
ignore: | ||
- goos: darwin | ||
goarch: '386' | ||
binary: '{{ .ProjectName }}_v{{ .Version }}' | ||
- skip: true | ||
archives: | ||
- format: zip | ||
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' | ||
checksum: | ||
extra_files: | ||
- glob: 'terraform-registry-manifest.json' | ||
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' | ||
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' | ||
algorithm: sha256 | ||
signs: | ||
- artifacts: checksum | ||
args: | ||
# if you are using this in a GitHub action or some other automated pipeline, you | ||
# need to pass the batch flag to indicate its not interactive. | ||
- "--batch" | ||
- "--local-user" | ||
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key | ||
- "--output" | ||
- "${signature}" | ||
- "--detach-sign" | ||
- "${artifact}" | ||
release: | ||
extra_files: | ||
- glob: 'terraform-registry-manifest.json' | ||
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' | ||
# If you want to manually examine the release before its live, uncomment this line: | ||
# draft: true | ||
changelog: | ||
skip: true | ||
skip: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,28 @@ | ||
# ENVS | ||
ifeq ($(OS),Windows_NT) | ||
PROJECT_DIR = $(shell cd) | ||
OS := windows | ||
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64) | ||
ARCH := amd64 | ||
endif | ||
ifeq ($(PROCESSOR_ARCHITECTURE),x86) | ||
ARCH := 386 | ||
endif | ||
else | ||
PROJECT_DIR = $(shell pwd) | ||
OS := $(shell uname | tr '[:upper:]' '[:lower:]') | ||
ARCH := $(shell uname -m) | ||
endif | ||
BIN_DIR = $(PROJECT_DIR)/bin | ||
TEST_DIR = $(PROJECT_DIR)/edgecenter/test | ||
ENV_TESTS_FILE = $(TEST_DIR)/.env | ||
PROJECT_DIR=$(shell pwd) | ||
BIN_DIR=$(PROJECT_DIR)/bin | ||
|
||
# BINARY | ||
BINARY_NAME = terraform-provider-edgecenter | ||
TAG_PREFIX = "v" | ||
TAG = $(shell git describe --tags) | ||
VERSION = $(shell git describe --tags $(LAST_TAG_COMMIT) | sed "s/^$(TAG_PREFIX)//") | ||
PLUGIN_PATH = ~/.terraform.d/plugins/local.edgecenter.ru/repo/edgecenter/$(VERSION)/$(OS)_$(ARCH) | ||
|
||
tidy: | ||
go mod tidy | ||
|
||
# BUILD | ||
build: tidy | ||
BINARY_NAME=terraform-provider-edgecenter | ||
TAG_PREFIX="v" | ||
TAG=$(shell git describe --tags) | ||
VERSION=$(shell git describe --tags $(LAST_TAG_COMMIT) | sed "s/^$(TAG_PREFIX)//") | ||
PLUGIN_PATH=~/.terraform.d/plugins/local.edgecenter.ru/repo/edgecenter/$(VERSION)/$(OS)_$(ARCH) | ||
|
||
.PHONY: build | ||
build: fmtcheck | ||
mkdir -p $(PLUGIN_PATH) | ||
go build -o $(PLUGIN_PATH)/$(BINARY_NAME)_v$(VERSION) | ||
go build -o bin/$(BINARY_NAME) | ||
|
||
build_debug: tidy | ||
mkdir -p $(PLUGIN_PATH) | ||
go build -o $(PLUGIN_PATH)/$(BINARY_NAME)_v$(VERSION) -gcflags '-N -l' | ||
go build -o bin/$(BINARY_NAME) -gcflags '-N -l' | ||
|
||
# CHECKS | ||
err_check: | ||
@sh -c "'$(PROJECT_DIR)/scripts/errcheck.sh'" | ||
|
||
linters: | ||
@test -f $(BIN_DIR)/golangci-lint || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.54.2 | ||
@$(BIN_DIR)/golangci-lint run | ||
|
||
linters_docker: # for windows | ||
docker run --rm -v $(PROJECT_DIR):/app -w /app golangci/golangci-lint:v1.54.2 golangci-lint run -v | ||
|
||
# TESTS | ||
envs_reader: | ||
go install github.com/joho/godotenv/cmd/godotenv@latest | ||
|
||
test_cloud_data_source: envs_reader | ||
godotenv -f $(ENV_TESTS_FILE) go test $(TEST_DIR) -tags cloud_data_source -short -timeout=20m | ||
|
||
test_cloud_resource: envs_reader | ||
godotenv -f $(ENV_TESTS_FILE) go test $(TEST_DIR) -tags cloud_resource -short -timeout=20m | ||
|
||
test_not_cloud: envs_reader | ||
godotenv -f $(ENV_TESTS_FILE) go test $(TEST_DIR) -tags dns storage cdn -v -timeout=5m | ||
|
||
# local test run (need to export VAULT_TOKEN env) | ||
install_jq: | ||
if test "$(OS)" = "linux"; then \ | ||
curl -L -o $(BIN_DIR)/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64; \ | ||
else \ | ||
curl -L -o $(BIN_DIR)/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-osx-amd64; \ | ||
fi | ||
chmod +x $(BIN_DIR)/jq | ||
|
||
install_vault: | ||
curl -L -o vault.zip https://releases.hashicorp.com/vault/1.13.3/vault_1.13.3_$(OS)_$(ARCH).zip | ||
unzip vault.zip && rm -f vault.zip && chmod +x vault | ||
mv vault $(BIN_DIR)/ | ||
|
||
download_env_file: envs_reader | ||
godotenv -f $(ENV_TESTS_FILE) $(BIN_DIR)/vault login -method=token $(VAULT_TOKEN) | ||
godotenv -f $(ENV_TESTS_FILE) $(BIN_DIR)/vault kv get -format=json --field data /CLOUD/terraform | $(BIN_DIR)/jq -r 'to_entries|map("\(.key)=\(.value)")|.[]' >> $(ENV_TESTS_FILE) | ||
|
||
test_local_data_source: envs_reader | ||
godotenv -f .local.env go test $(TEST_DIR) -tags cloud_data_source -short -timeout=5m -v | ||
|
||
test_local_resource: envs_reader | ||
godotenv -f .local.env go test $(TEST_DIR) -tags cloud_resource -short -timeout=10m -v | ||
|
||
# DOCS | ||
docs_fmt: | ||
terraform fmt -recursive ./examples/ | ||
.PHONY: lint | ||
lint: | ||
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | ||
@golangci-lint run -v ./... | ||
|
||
docs: docs_fmt | ||
go get github.com/hashicorp/terraform-plugin-docs/cmd/[email protected] | ||
make tidy | ||
tfplugindocs --tf-version=1.5.0 --provider-name=edgecenter | ||
.PHONY: test | ||
test: | ||
go test -v -timeout=2m | ||
|
||
.PHONY: tidy build build_debug err_check linters linters_docker envs_reader test_cloud_data_source test_cloud_resource test_not_cloud install_jq install_vault download_env_file test_local_data_source test_local_resource docs_fmt docs | ||
.PHONY: fmtcheck | ||
fmtcheck: | ||
@sh -c "'$(PROJECT_DIR)/scripts/gofmtcheck.sh'" |
Oops, something went wrong.