Skip to content

Commit

Permalink
feat: Implemented plugin for working with Bitbucket
Browse files Browse the repository at this point in the history
  • Loading branch information
durandj committed Mar 14, 2021
0 parents commit 22c1a34
Show file tree
Hide file tree
Showing 15 changed files with 935 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# top-most EditorConfig file
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8

[*.json]
indent_style = space
indent_size = 4

[Makefile,*.Makefile]
indent_style = tab
indent_size = 4

[*.go]
indent_style = tab
indent_size = 4

[*.sh]
indent_style = space
indent_size = 4

[*.{yml,yaml}]
indent_style = space
indent_size = 2
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2

updates:
- package-ecosystem: gomod
directory: /
schedule:
interval: weekly

assignees:
- durandj
reviewers:
- durandj

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly

assignees:
- durandj
reviewers:
- durandj
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
run: |
make lint
build:
runs-on: ${{ matrix.os }}
needs: lint
strategy:
fail-fast: true
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.16
- run: make test
- run: make build

release:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Get release dependencies
run: |
go get github.com/mitchellh/gox
go get github.com/tcnksm/ghr
- uses: go-semantic-release/action@v1
id: semrel
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
ghr: true
- run: |
gox \
-parallel 4 \
-osarch="linux/amd64 darwin/amd64 linux/arm windows/amd64" \
-ldflags="-extldflags '-static' -s -w -X github.com/durandj/semantic-release-condition-bitbucket/pkg/condition.CIVERSION=${{steps.semrel.outputs.version}}" -output="bin/{{.Dir}}_v${{steps.semrel.outputs.version}}_{{.OS}}_{{.Arch}}" \
./cmd/condition-bitbucket/
cd bin/ && shasum -a 256 * > ./condition-bitbucket_v${{steps.semrel.outputs.version}}_checksums.txt && cd -
if: steps.semrel.outputs.version != ''
env:
CGO_ENABLED: 0
- run: ghr $(cat .ghr) bin/
if: steps.semrel.outputs.version != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
181 changes: 181 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
### condition-bitbucket ###
/.semrel
/bin



### Go ###
# 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/



### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*



### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk



### JetBrains ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser



### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/

### Vim ###


# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# Session
Session.vim
Sessionx.vim

# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.16.0
25 changes: 25 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
linters:
enable:
- bodyclose
- errcheck
- dupl
- gocognit
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- golint
- gosec
- govet
- lll
- nakedret
- prealloc
- scopelint
- staticcheck
- unconvert
- unparam
- whitespace

issues:
exclude-use-default: false
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"go.inferGopath": false,
"go.lintTool": "golangci-lint",
}
7 changes: 7 additions & 0 deletions License.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2021 James Durand

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43 changes: 43 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
REPO_ROOT = $(shell git rev-parse --show-toplevel)
BIN_DIR = $(REPO_ROOT)/bin

$(BIN_DIR):
mkdir -p $@

######################################################################

NAME = condition-bitbucket
BIN = $(BIN_DIR)/$(NAME)

######################################################################

GOLANGCILINT_VERSION = v1.38.0
GOLANGCILINT_NAME = golangci-lint
GOLANGCILINT_PATH = $(REPO_ROOT)/bin
GOLANGCILINT_URL = https://install.goreleaser.com/github.com/golangci/golangci-lint.sh
GOLANGCILINT = $(REPO_ROOT)/bin/$(GOLANGCILINT_NAME)

$(GOLANGCILINT):
cd $(REPO_ROOT); curl -sfL $(GOLANGCILINT_URL) | sh -s $(GOLANGCILINT_VERSION)

######################################################################



######################################################################

.PHONY: clean
clean:
rm -f $(BIN)

.PHONY: lint
lint: $(GOLANGCILINT)
$(GOLANGCILINT) run

.PHONY: test
test:
go test -v ./...

.PHONY: build
build:
go build -o $(BIN) $(REPO_ROOT)/cmd/condition-bitbucket
Loading

0 comments on commit 22c1a34

Please sign in to comment.