Skip to content

Commit

Permalink
v1.0.1
Browse files Browse the repository at this point in the history
Signed-off-by: kuritka <[email protected]>
  • Loading branch information
kuritka committed Jun 8, 2022
1 parent 3360a87 commit 6942794
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 17 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2021 The k8gb Contributors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic
name: Build, Test
on:
push:
pull_request:
branches:
- master

jobs:
test-build:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.14", "1.15", "1.16", "1.17", "1.18"]
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
id: go

- name: Install Dependencies
env:
GOPROXY: https://proxy.golang.org,direct
run: go mod download

- name: Test
run: go test -race ./... --cover
13 changes: 6 additions & 7 deletions .github/workflows/build.yml → .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
#
# Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic
name: lint, test
name: Lint, License
on:
push:
pull_request:
Expand All @@ -27,16 +27,15 @@ jobs:
steps:
- uses: actions/checkout@v2
# see: https://golangci-lint.run/usage/configuration/#config-file
- name: golangci-lint
uses: golangci/golangci-lint-action@v2.5.2
- name: Lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.42.1
version: v1.46

- name: golic
- name: GoLic
run: |
go install github.com/AbsaOSS/[email protected]
golic inject --dry -x -t apache2
- name: go test
run: go test ./...

run: go test ./...
47 changes: 47 additions & 0 deletions .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2021 The k8gb Contributors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic
name: Tag

on:
push:
paths-ignore:
- '**.md'
- '**_test.go'
- '.github/workflows/**'
branches:
- master
workflow_dispatch:
branches:
- master
jobs:
tag-build-publish:
name: Tag
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: "0" # make sure we get all commits!

- name: Bump version and push tag
id: bump
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_BRANCHES: master
WITH_V: true
DEFAULT_BUMP: patch
# PRERELEASE_SUFFIX: beta
24 changes: 21 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,18 @@
# limitations under the License.
#
# Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic
SHELL := bash

ifndef NO_COLOR
YELLOW=\033[0;33m
CYAN=\033[1;36m
RED=\033[31m
# no color
NC=\033[0m
endif

GOLIC_VERSION ?= v0.5.0
GOLINT_VERSION ?= v1.45.0

# check integrity
.PHONY: check
Expand All @@ -22,19 +33,26 @@ check: lint license test ## Check project integrity
# run glonag-ci
.PHONY: lint
lint:
golangci-lint run
@echo -e "\n$(YELLOW)Running the linters$(NC)"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLINT_VERSION)
$(GOBIN)/golangci-lint run

# updates source code with license headers
.PHONY: license
license:
$(call golic,-t apache2)
@echo -e "\n$(YELLOW)Injecting the license$(NC)"
@go install github.com/AbsaOSS/golic@$(GOLIC_VERSION)
$(GOBIN)/golic inject -t apache2

# run tests
.PHONY: test
test:
go test ./... -coverprofile cover.out
go test ./... -race -coverprofile cover.out

define golic
@echo -e "\n$(YELLOW)Injecting the license$(NC)"
@go install github.com/AbsaOSS/golic@$(GOLIC_VERSION)
$(GOBIN)/golic inject $1
endef

all: check
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# ENV binder
[![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
[![Go Reference](https://pkg.go.dev/badge/github.com/AbsaOSS/env-binder.svg)](https://pkg.go.dev/github.com/AbsaOSS/env-binder?branch=master)
![Build Status](https://github.com/AbsaOSS/env-binder/actions/workflows/build.yaml/badge.svg?branch=master)
![Linter](https://github.com/AbsaOSS/env-binder/actions/workflows/lint.yaml/badge.svg?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/AbsaOSS/env-binder)](https://goreportcard.com/report/github.com/AbsaOSS/env-binder?branch=master)


The ENV-BINDER package is used to easily bind environment variables to GO structures. ENV-BINDER is designed to
be usable in the widest possible range of scenarios.Among other things, it supports variable
prefixes and bindings to unexported arrays. Take a look at the following usage example:
Expand Down
8 changes: 1 addition & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
module github.com/AbsaOSS/env-binder

go 1.17
go 1.14

require github.com/stretchr/testify v1.7.0

require (
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)

0 comments on commit 6942794

Please sign in to comment.