-
-
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
Jose Diaz-Gonzalez
committed
Feb 4, 2021
0 parents
commit d7ab1b3
Showing
24 changed files
with
1,819 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
machine: | ||
docker_layer_caching: false | ||
steps: | ||
- checkout | ||
- run: | ||
command: | | ||
make version | ||
if [[ "$CIRCLE_BRANCH" == "release" ]]; then | ||
make .env.docker | ||
fi | ||
- run: make circleci | ||
- run: make build-docker-image | ||
- run: | ||
command: | | ||
make build-in-docker | ||
[[ -d build ]] && sudo chown -R circleci:circleci build | ||
- run: make validate-in-docker | ||
- store_artifacts: | ||
path: build | ||
destination: build | ||
- run: | ||
command: | | ||
if [[ "$CIRCLE_BRANCH" == "release" ]]; then | ||
make release-in-docker | ||
fi |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Dockerfile* | ||
LICENSE | ||
README.md |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
root = true | ||
|
||
[*] | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace = true | ||
|
||
[Makefile] | ||
insert_final_newline = true | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[*.go] | ||
insert_final_newline = true | ||
indent_style = tab | ||
indent_size = 4 |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, build with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Build output | ||
build/* | ||
|
||
# Release output | ||
release/* | ||
|
||
# Validation output | ||
validation/* | ||
|
||
# .env files | ||
.env* | ||
|
||
netrc |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM golang:1.15.6-buster | ||
|
||
RUN apt-get update \ | ||
&& apt install apt-transport-https build-essential curl gnupg2 lintian rpm rsync rubygems-integration ruby-dev ruby -qy \ | ||
&& git clone https://github.com/bats-core/bats-core.git /tmp/bats-core \ | ||
&& cd /tmp/bats-core \ | ||
&& ./install.sh /usr/local \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN gem install --no-ri --no-rdoc --quiet rake fpm package_cloud | ||
|
||
WORKDIR /src |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY ./build/linux/bats-retry /bats-retry | ||
ENTRYPOINT ["/bats-retry"] |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License | ||
|
||
Copyright (c) 2021 Jose Diaz-Gonzalez | ||
|
||
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. |
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 |
---|---|---|
@@ -0,0 +1,97 @@ | ||
NAME = netrc | ||
EMAIL = [email protected] | ||
MAINTAINER = josegonzalez | ||
MAINTAINER_NAME = Jose Diaz-Gonzalez | ||
REPOSITORY = go-netrc | ||
HARDWARE = $(shell uname -m) | ||
SYSTEM_NAME = $(shell uname -s | tr '[:upper:]' '[:lower:]') | ||
BASE_VERSION ?= 0.2.1 | ||
IMAGE_NAME ?= $(MAINTAINER)/$(REPOSITORY) | ||
|
||
ifeq ($(CIRCLE_BRANCH),release) | ||
VERSION ?= $(BASE_VERSION) | ||
DOCKER_IMAGE_VERSION = $(VERSION) | ||
else | ||
VERSION = $(shell echo "${BASE_VERSION}")build+$(shell git rev-parse --short HEAD) | ||
DOCKER_IMAGE_VERSION = $(shell echo "${BASE_VERSION}")build-$(shell git rev-parse --short HEAD) | ||
endif | ||
|
||
version: | ||
@echo "$(CIRCLE_BRANCH)" | ||
@echo "$(VERSION)" | ||
|
||
define PACKAGE_DESCRIPTION | ||
Utility that allows users to manage netrc files | ||
endef | ||
|
||
export PACKAGE_DESCRIPTION | ||
|
||
LIST = build release release-packagecloud validate | ||
targets = $(addsuffix -in-docker, $(LIST)) | ||
|
||
.env.docker: | ||
@rm -f .env.docker | ||
@touch .env.docker | ||
@echo "CIRCLE_BRANCH=$(CIRCLE_BRANCH)" >> .env.docker | ||
@echo "GITHUB_ACCESS_TOKEN=$(GITHUB_ACCESS_TOKEN)" >> .env.docker | ||
@echo "IMAGE_NAME=$(IMAGE_NAME)" >> .env.docker | ||
@echo "VERSION=$(VERSION)" >> .env.docker | ||
|
||
build: prebuild | ||
@$(MAKE) build/darwin/$(NAME) | ||
@$(MAKE) build/linux/$(NAME) | ||
|
||
build-docker-image: | ||
docker build --rm -q -f Dockerfile.build -t $(IMAGE_NAME):build . | ||
|
||
$(targets): %-in-docker: .env.docker | ||
docker run \ | ||
--env-file .env.docker \ | ||
--rm \ | ||
--volume /var/lib/docker:/var/lib/docker \ | ||
--volume /var/run/docker.sock:/var/run/docker.sock:ro \ | ||
--volume ${PWD}:/src/github.com/$(MAINTAINER)/$(REPOSITORY) \ | ||
--workdir /src/github.com/$(MAINTAINER)/$(REPOSITORY) \ | ||
$(IMAGE_NAME):build make -e $(@:-in-docker=) | ||
|
||
build/darwin/$(NAME): | ||
mkdir -p build/darwin | ||
CGO_ENABLED=0 GOOS=darwin go build -a -asmflags=-trimpath=/src -gcflags=-trimpath=/src \ | ||
-ldflags "-s -w -X main.Version=$(VERSION)" \ | ||
-o build/darwin/$(NAME) | ||
|
||
build/linux/$(NAME): | ||
mkdir -p build/linux | ||
CGO_ENABLED=0 GOOS=linux go build -a -asmflags=-trimpath=/src -gcflags=-trimpath=/src \ | ||
-ldflags "-s -w -X main.Version=$(VERSION)" \ | ||
-o build/linux/$(NAME) | ||
|
||
clean: | ||
rm -rf build release validation | ||
|
||
circleci: | ||
docker version | ||
rm -f ~/.gitconfig | ||
|
||
docker-image: | ||
docker build --rm -q -f Dockerfile.hub -t $(IMAGE_NAME):$(DOCKER_IMAGE_VERSION) . | ||
|
||
bin/gh-release: | ||
mkdir -p bin | ||
curl -o bin/gh-release.tgz -sL https://github.com/progrium/gh-release/releases/download/v2.2.1/gh-release_2.2.1_$(SYSTEM_NAME)_$(HARDWARE).tgz | ||
tar xf bin/gh-release.tgz -C bin | ||
chmod +x bin/gh-release | ||
|
||
release: build bin/gh-release | ||
rm -rf release && mkdir release | ||
tar -zcf release/$(NAME)_$(VERSION)_linux_$(HARDWARE).tgz -C build/linux $(NAME) | ||
tar -zcf release/$(NAME)_$(VERSION)_darwin_$(HARDWARE).tgz -C build/darwin $(NAME) | ||
bin/gh-release create $(MAINTAINER)/$(REPOSITORY) $(VERSION) $(shell git rev-parse --abbrev-ref HEAD) | ||
|
||
|
||
validate: | ||
mkdir -p validation | ||
bats test.bats | ||
|
||
prebuild: | ||
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# netrc | ||
|
||
Utility that allows users to manage netrc files. | ||
|
||
## Usage | ||
|
||
> Warning: Macro setting is currently unhandled | ||
``` | ||
Usage: netrc [--version] [--help] <command> [<args>] | ||
Available commands are: | ||
get Get an entry from the .netrc file | ||
set Set an entry in the .netrc file | ||
unset Unset an entry from the .netrc file | ||
``` |
Oops, something went wrong.