Skip to content

Commit

Permalink
Hello, terraform provider pipecd.
Browse files Browse the repository at this point in the history
Co-authored-by: kurochan <[email protected]>
Co-authored-by: sivchari <[email protected]>
Signed-off-by: arabian9ts <[email protected]>
  • Loading branch information
3 people committed Jul 13, 2023
0 parents commit 31cbbf3
Show file tree
Hide file tree
Showing 33 changed files with 3,122 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: lint-test

on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main

env:
GO_VERSION: 1.20.5

jobs:
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- name: Run golangci-lint
run: golangci-lint run ./...
test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Run tests
run: make testacc
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 'release'

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v3'
with:
fetch-depth: 0

- uses: 'actions/setup-go@v3'
with:
go-version: '1.20'

- id: 'import_gpg'
uses: 'crazy-max/ghaction-import-gpg@v5'
with:
gpg_private_key: '${{ secrets.GPG_PRIVATE_KEY }}'
passphrase: '${{ secrets.PASSPHRASE }}'

- uses: 'goreleaser/goreleaser-action@v3'
with:
version: 'v1.14.1'
args: 'release --rm-dist'
env:
GPG_FINGERPRINT: '${{ steps.import_gpg.outputs.fingerprint }}'
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
.env
80 changes: 80 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
run:
timeout: 5m

linters-settings:
govet:
enable-all: true
disable:
- shadow
misspell:
locale: US
lll:
line-length: 160
revive:
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-naming
- name: var-naming
forbidigo:
forbid:
- t\.Fatal.*
- fmt\.Print.*

linters:
disable-all: true
enable:
# Errcheck is a program for checking for unchecked errors in go programs.
# These unchecked errors can be critical bugs in some cases
- errcheck
# Linter for Go source code that specializes in simplifying a code
- gosimple
# Vet examines Go source code and reports suspicious constructs,
# such as Printf calls whose arguments do not align with the format string
- govet
# Forbids identifiers
- forbidigo
# Staticcheck is a go vet on steroids, applying a ton of static analysis checks
- staticcheck
# Like the front-end of a Go compiler, parses and type-checks Go code
- typecheck
# Checks Go code for unused constants, variables, functions and types
- unused
# checks whether HTTP response body is closed successfully
- bodyclose
# containedctx is a linter that detects struct contained context.Context field
- containedctx
# Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error.
- errname
# checks for pointers to enclosing loop variables
- exportloopref
# Gofumpt checks whether code was gofumpt-ed.
- gofumpt
# Reports long lines
- lll
# Finds commonly misspelled English words in comments
- misspell
# Finds naked returns in functions greater than a specified function length
- nakedret
# paralleltest detects missing usage of t.Parallel() method in your Go test
- paralleltest
# Finds slice declarations that could potentially be pre-allocated
- prealloc
# find code that shadows one of Go's predeclared identifiers
- predeclared
# Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint
- revive
# Stylecheck is a replacement for golint
- stylecheck
# tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
- tenv

issues:
exclude-use-default: true
max-per-linter: 0
max-same-issues: 0
exclude: []
exclude-rules:
# All
- path: \.go
text: "fieldalignment:"
linters:
- govet
50 changes: 50 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
before:
hooks:
- go mod tidy
builds:
- env:
- 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 }}'
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:
- "--batch"
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}"
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"
release:
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
changelog:
skip: true
4 changes: 4 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.github @pipe-cd/admin
GNUmakefile @pipe-cd/admin

* @nghialv @khanhtc1202 @kentakozuka @arabian9ts @kurochan @sivchari
5 changes: 5 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
default: testacc

.PHONY: testacc
testacc:
TF_ACC=1 go test -race -parallel 3 ./... -v -timeout 5m
Loading

0 comments on commit 31cbbf3

Please sign in to comment.