-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from gliderlabs/master
Release 0.7.0
- Loading branch information
Showing
12 changed files
with
317 additions
and
75 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,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,11 @@ | ||
--- | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "docker" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
- package-ecosystem: "gomod" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
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,44 @@ | ||
--- | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- '*' | ||
push: | ||
branches: | ||
- 'master' | ||
- 'release' | ||
|
||
jobs: | ||
build: | ||
name: build | ||
runs-on: ubuntu-18.04 | ||
strategy: | ||
fail-fast: true | ||
env: | ||
GITHUB_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | ||
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: make version | ||
run: | | ||
make version .env.docker | ||
- run: make ci-report | ||
- run: make build-docker-image | ||
- run: make build-in-docker | ||
- run: make validate-in-docker | ||
- name: upload packages | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: build | ||
path: build/**/* | ||
- name: make release-in-docker | ||
run: | | ||
if [[ "${GITHUB_REF#refs/heads/}" == "release" ]]; then | ||
export CI_BRANCH=${GITHUB_REF#refs/heads/} | ||
export PACKAGECLOUD_REPOSITORY=dokku/dokku | ||
rm .env.docker | ||
make .env.docker release-in-docker release-packagecloud-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 |
---|---|---|
|
@@ -22,6 +22,3 @@ validation/* | |
|
||
# .env files | ||
.env* | ||
|
||
build | ||
site |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM golang:1.17.2-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/gliderlabs-sigil-amd64 /gliderlabs-sigil | ||
ENTRYPOINT ["/gliderlabs-sigil"] |
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,73 +1,208 @@ | ||
NAME=sigil | ||
ARCH=$(shell uname -m) | ||
ORG=gliderlabs | ||
VERSION=0.6.0 | ||
define DESCRIPTION | ||
NAME = gliderlabs-sigil | ||
EMAIL = [email protected] | ||
MAINTAINER = gliderlabs | ||
MAINTAINER_NAME = Jose Diaz-Gonzalez | ||
REPOSITORY = sigil | ||
HARDWARE = $(shell uname -m) | ||
SYSTEM_NAME = $(shell uname -s | tr '[:upper:]' '[:lower:]') | ||
BASE_VERSION ?= 0.7.0 | ||
IMAGE_NAME ?= $(MAINTAINER)/$(REPOSITORY) | ||
PACKAGECLOUD_REPOSITORY ?= dokku/dokku-betafish | ||
|
||
ifeq ($(CI_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 "$(CI_BRANCH)" | ||
@echo "$(VERSION)" | ||
|
||
define PACKAGE_DESCRIPTION | ||
Standalone string interpolator and template processor | ||
Sigil is a command line tool for template processing | ||
and POSIX-compliant variable expansion. It was created | ||
for configuration templating, but can be used for any | ||
text processing. | ||
endef | ||
REPO_NAME ?= gliderlabs/sigil | ||
ARCHITECTURE = amd64 | ||
|
||
export DESCRIPTION | ||
export PACKAGE_DESCRIPTION | ||
|
||
build: | ||
glu build darwin,linux ./cmd | ||
ifdef CIRCLECI | ||
sudo chown -R circleci:circleci build | ||
endif | ||
$(MAKE) deb | ||
$(MAKE) rpm | ||
LIST = build release release-packagecloud validate | ||
targets = $(addsuffix -in-docker, $(LIST)) | ||
|
||
test: | ||
basht tests/*.bash | ||
.env.docker: | ||
@rm -f .env.docker | ||
@touch .env.docker | ||
@echo "CI_BRANCH=$(CI_BRANCH)" >> .env.docker | ||
@echo "GITHUB_ACCESS_TOKEN=$(GITHUB_ACCESS_TOKEN)" >> .env.docker | ||
@echo "IMAGE_NAME=$(IMAGE_NAME)" >> .env.docker | ||
@echo "PACKAGECLOUD_REPOSITORY=$(PACKAGECLOUD_REPOSITORY)" >> .env.docker | ||
@echo "PACKAGECLOUD_TOKEN=$(PACKAGECLOUD_TOKEN)" >> .env.docker | ||
@echo "VERSION=$(VERSION)" >> .env.docker | ||
|
||
install: build | ||
install build/$(shell uname -s)/$(NAME) /usr/local/bin | ||
build: prebuild | ||
@$(MAKE) build/darwin/$(NAME) | ||
@$(MAKE) build/linux/$(NAME)-amd64 | ||
@$(MAKE) build/linux/$(NAME)-armhf | ||
@$(MAKE) build/deb/$(NAME)_$(VERSION)_amd64.deb | ||
@$(MAKE) build/deb/$(NAME)_$(VERSION)_armhf.deb | ||
@$(MAKE) build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm | ||
|
||
deps: | ||
go get github.com/gliderlabs/glu | ||
go get -u github.com/progrium/basht/... | ||
go get -d ./cmd | ||
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 /usr/bin/docker:/usr/local/bin/docker \ | ||
--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) cmd/sigil.go | ||
|
||
build/linux/$(NAME)-amd64: | ||
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)-amd64 cmd/sigil.go | ||
|
||
build/linux/$(NAME)-armhf: | ||
mkdir -p build/linux | ||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -a -asmflags=-trimpath=/src -gcflags=-trimpath=/src \ | ||
-ldflags "-s -w -X main.Version=$(VERSION)" \ | ||
-o build/linux/$(NAME)-armhf cmd/sigil.go | ||
|
||
build/deb/$(NAME)_$(VERSION)_amd64.deb: build/linux/$(NAME)-amd64 | ||
export SOURCE_DATE_EPOCH=$(shell git log -1 --format=%ct) \ | ||
&& mkdir -p build/deb \ | ||
&& fpm \ | ||
--architecture amd64 \ | ||
--category utils \ | ||
--description "$$PACKAGE_DESCRIPTION" \ | ||
--input-type dir \ | ||
--license 'MIT License' \ | ||
--maintainer "$(MAINTAINER_NAME) <$(EMAIL)>" \ | ||
--name $(NAME) \ | ||
--output-type deb \ | ||
--package build/deb/$(NAME)_$(VERSION)_amd64.deb \ | ||
--url "https://github.com/$(MAINTAINER)/$(REPOSITORY)" \ | ||
--vendor "" \ | ||
--version $(VERSION) \ | ||
--verbose \ | ||
build/linux/$(NAME)-amd64=/usr/bin/$(NAME) \ | ||
LICENSE=/usr/share/doc/$(NAME)/copyright | ||
|
||
release: | ||
glu release v$(VERSION) | ||
package_cloud push "dokku/dokku/ubuntu/xenial" build/deb/$(subst /,_,$(REPO_NAME))_$(VERSION)_amd64.deb | ||
package_cloud push "dokku/dokku/ubuntu/bionic" build/deb/$(subst /,_,$(REPO_NAME))_$(VERSION)_amd64.deb | ||
package_cloud push "dokku/dokku/ubuntu/focal" build/deb/$(subst /,_,$(REPO_NAME))_$(VERSION)_amd64.deb | ||
package_cloud push "dokku/dokku/debian/buster" build/deb/$(subst /,_,$(REPO_NAME))_$(VERSION)_amd64.deb | ||
package_cloud push "dokku/dokku/debian/stretch" build/deb/$(subst /,_,$(REPO_NAME))_$(VERSION)_amd64.deb | ||
package_cloud push "dokku/dokku/el/7" build/rpm/$(subst /,-,$(REPO_NAME))-$(VERSION)-1.x86_64.rpm | ||
build/deb/$(NAME)_$(VERSION)_armhf.deb: build/linux/$(NAME)-armhf | ||
export SOURCE_DATE_EPOCH=$(shell git log -1 --format=%ct) \ | ||
&& mkdir -p build/deb \ | ||
&& fpm \ | ||
--architecture armhf \ | ||
--category utils \ | ||
--description "$$PACKAGE_DESCRIPTION" \ | ||
--input-type dir \ | ||
--license 'MIT License' \ | ||
--maintainer "$(MAINTAINER_NAME) <$(EMAIL)>" \ | ||
--name $(NAME) \ | ||
--output-type deb \ | ||
--package build/deb/$(NAME)_$(VERSION)_armhf.deb \ | ||
--url "https://github.com/$(MAINTAINER)/$(REPOSITORY)" \ | ||
--vendor "" \ | ||
--version $(VERSION) \ | ||
--verbose \ | ||
build/linux/$(NAME)-armhf=/usr/bin/$(NAME) \ | ||
LICENSE=/usr/share/doc/$(NAME)/copyright | ||
|
||
build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm: build/linux/$(NAME)-amd64 | ||
export SOURCE_DATE_EPOCH=$(shell git log -1 --format=%ct) \ | ||
&& mkdir -p build/rpm \ | ||
&& fpm \ | ||
--architecture x86_64 \ | ||
--category utils \ | ||
--description "$$PACKAGE_DESCRIPTION" \ | ||
--input-type dir \ | ||
--license 'MIT License' \ | ||
--maintainer "$(MAINTAINER_NAME) <$(EMAIL)>" \ | ||
--name $(NAME) \ | ||
--output-type rpm \ | ||
--package build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm \ | ||
--rpm-os linux \ | ||
--url "https://github.com/$(MAINTAINER)/$(REPOSITORY)" \ | ||
--vendor "" \ | ||
--version $(VERSION) \ | ||
--verbose \ | ||
build/linux/$(NAME)-amd64=/usr/bin/$(NAME) \ | ||
LICENSE=/usr/share/doc/$(NAME)/copyright | ||
|
||
clean: | ||
rm -rf build release | ||
|
||
.PHONY: build release | ||
|
||
deb: | ||
mkdir -p build/deb | ||
fpm -t deb -s dir -n $(subst /,-,$(REPO_NAME)) \ | ||
--version $(VERSION) \ | ||
--architecture amd64 \ | ||
--package build/deb/$(subst /,_,$(REPO_NAME))_$(VERSION)_amd64.deb \ | ||
--url "https://github.com/$(REPO_NAME)" \ | ||
--maintainer "Jose Diaz-Gonzalez <[email protected]>" \ | ||
--category utils \ | ||
--description "$$DESCRIPTION" \ | ||
--license 'MIT License' \ | ||
build/Linux/sigil=/usr/bin/$(NAME) | ||
|
||
rpm: | ||
mkdir -p build/rpm | ||
fpm -t rpm -s dir -n $(subst /,-,$(REPO_NAME)) \ | ||
--version $(VERSION) \ | ||
--architecture x86_64 \ | ||
--package build/rpm/$(subst /,-,$(REPO_NAME))-$(VERSION)-1.x86_64.rpm \ | ||
--url "https://github.com/$(REPO_NAME)" \ | ||
--category utils \ | ||
--description "$$DESCRIPTION" \ | ||
--license 'MIT License' \ | ||
build/Linux/sigil=/usr/bin/$(NAME) | ||
rm -rf build release validation | ||
|
||
ci-report: | ||
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.3.3/gh-release_2.3.3_$(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_amd64.tgz -C build/linux $(NAME)-amd64 | ||
tar -zcf release/$(NAME)_$(VERSION)_linux_armhf.tgz -C build/linux $(NAME)-armhf | ||
tar -zcf release/$(NAME)_$(VERSION)_darwin_$(HARDWARE).tgz -C build/darwin $(NAME) | ||
cp build/deb/$(NAME)_$(VERSION)_amd64.deb release/$(NAME)_$(VERSION)_amd64.deb | ||
cp build/deb/$(NAME)_$(VERSION)_armhf.deb release/$(NAME)_$(VERSION)_armhf.deb | ||
cp build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm release/$(NAME)-$(VERSION)-1.x86_64.rpm | ||
bin/gh-release create $(MAINTAINER)/$(REPOSITORY) $(VERSION) $(shell git rev-parse --abbrev-ref HEAD) | ||
|
||
release-packagecloud: | ||
@$(MAKE) release-packagecloud-deb | ||
@$(MAKE) release-packagecloud-rpm | ||
|
||
release-packagecloud-deb: build/deb/$(NAME)_$(VERSION)_amd64.deb build/deb/$(NAME)_$(VERSION)_armhf.deb | ||
package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/bionic build/deb/$(NAME)_$(VERSION)_amd64.deb | ||
package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/focal build/deb/$(NAME)_$(VERSION)_amd64.deb | ||
package_cloud push $(PACKAGECLOUD_REPOSITORY)/debian/stretch build/deb/$(NAME)_$(VERSION)_amd64.deb | ||
package_cloud push $(PACKAGECLOUD_REPOSITORY)/debian/buster build/deb/$(NAME)_$(VERSION)_amd64.deb | ||
package_cloud push $(PACKAGECLOUD_REPOSITORY)/debian/bullseye build/deb/$(NAME)_$(VERSION)_amd64.deb | ||
package_cloud push $(PACKAGECLOUD_REPOSITORY)/raspbian/buster build/deb/$(NAME)_$(VERSION)_armhf.deb | ||
|
||
release-packagecloud-rpm: build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm | ||
package_cloud push $(PACKAGECLOUD_REPOSITORY)/el/7 build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm | ||
|
||
validate: | ||
mkdir -p validation | ||
lintian build/deb/$(NAME)_$(VERSION)_amd64.deb || true | ||
lintian build/deb/$(NAME)_$(VERSION)_armhf.deb || true | ||
dpkg-deb --info build/deb/$(NAME)_$(VERSION)_amd64.deb | ||
dpkg-deb --info build/deb/$(NAME)_$(VERSION)_armhf.deb | ||
dpkg -c build/deb/$(NAME)_$(VERSION)_amd64.deb | ||
dpkg -c build/deb/$(NAME)_$(VERSION)_armhf.deb | ||
cd validation && ar -x ../build/deb/$(NAME)_$(VERSION)_amd64.deb | ||
cd validation && ar -x ../build/deb/$(NAME)_$(VERSION)_armhf.deb | ||
cd validation && rpm2cpio ../build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm > $(NAME)-$(VERSION)-1.x86_64.cpio | ||
ls -lah build/deb build/rpm validation | ||
sha1sum build/deb/$(NAME)_$(VERSION)_amd64.deb | ||
sha1sum build/deb/$(NAME)_$(VERSION)_armhf.deb | ||
sha1sum build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm | ||
go get -u github.com/progrium/basht/... | ||
basht tests/*.bash | ||
|
||
prebuild: | ||
true |
Oops, something went wrong.