Skip to content

Commit

Permalink
Merge pull request #65 from mrtazz/mrtazz/cleanup
Browse files Browse the repository at this point in the history
Some cleanups
  • Loading branch information
mrtazz authored Feb 18, 2022
2 parents 2c59d1f + 2071507 commit 0416c97
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 68 deletions.
32 changes: 9 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ jobs:
build:
name: build and test
runs-on: ubuntu-latest
env:
BUILDER_NAME: "GitHub Actions"
BUILDER_EMAIL: [email protected]

steps:

- name: Set up Go 1.13
uses: actions/setup-go@v1
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.13
go-version: 1.17
id: go

- name: Check out code
uses: actions/checkout@master
uses: actions/checkout@v2
with:
fetch-depth: 1

Expand All @@ -24,26 +28,8 @@ jobs:
sudo dpkg -i pandoc-2.7.3-1-amd64.deb
- name: build and run unit tests
run: BUILDER_NAME=CI [email protected] make clean all test
run: make clean all test

- name: Run checkmake on Makefile
run: ./checkmake Makefile

docker:
needs: build
name: docker image build and release

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Build the Docker image
run: docker build --build-arg BUILDER_NAME=CI --build-arg [email protected] . --file Dockerfile --tag mrtazz/checkmake:${GITHUB_SHA} --tag mrtazz/checkmake:latest

- name: push the docker image to docker hub
if: github.ref == 'refs/heads/main'
run: |
echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u mrtazz --password-stdin
docker push mrtazz/checkmake:${GITHUB_SHA}
docker push mrtazz/checkmake:latest
docker logout hub.docker.com
64 changes: 58 additions & 6 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
name: packages
name: release
on:
push:
tags:
- '*'

jobs:
packages:
name: build and deploy
name: packagecloud
runs-on: ubuntu-latest
env:
BUILDER_NAME: CI
BUILDER_EMAIL: ci@actions.github.com
BUILDER_NAME: "GitHub Actions"
BUILDER_EMAIL: noreply@actions.github.com

steps:

- name: Set up Go 1.13
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: 1.13
id: go

- name: Check out code
uses: actions/checkout@master
uses: actions/checkout@v2
with:
fetch-depth: 1

Expand All @@ -40,7 +40,59 @@ jobs:
env:
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}

release:
name: github
runs-on: ubuntu-latest
env:
BUILDER_NAME: "GitHub Actions"
BUILDER_EMAIL: [email protected]

steps:

- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
id: go

- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: install dependencies
run: |
sudo wget https://github.com/jgm/pandoc/releases/download/2.7.3/pandoc-2.7.3-1-amd64.deb
sudo dpkg -i pandoc-2.7.3-1-amd64.deb
- name: build for platforms
run: |
BUILD_GOARCH=amd64 BUILD_GOOS=freebsd make build-standalone
BUILD_GOARCH=amd64 BUILD_GOOS=linux make build-standalone
BUILD_GOARCH=amd64 BUILD_GOOS=darwin make build-standalone
- name: create release
run: make github-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docker:
name: docker
env:
BUILDER_NAME: "GitHub Actions"
BUILDER_EMAIL: [email protected]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build --build-arg BUILDER_NAME=CI --build-arg [email protected] . --file Dockerfile --tag mrtazz/checkmake:${GITHUB_SHA} --tag mrtazz/checkmake:latest

- name: push the docker image to docker hub
if: github.ref == 'refs/heads/main'
run: |
echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u mrtazz --password-stdin
docker push mrtazz/checkmake:${GITHUB_SHA}
docker push mrtazz/checkmake:latest
docker logout hub.docker.com
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ profile.out
*.rpm
*.deb
.idea/
.release_artifacts/
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

23 changes: 18 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# some housekeeping tasks
#

export GO15VENDOREXPERIMENT = 1
export GO111MODULE = on
export GOFLAGS = -mod=vendor

Expand All @@ -15,6 +14,15 @@ GOVERSION := $(shell go version)
BUILDTIME := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
BUILDDATE := $(shell date -u +"%B %d, %Y")

BUILD_GOOS ?= $(shell go env GOOS)
BUILD_GOARCH ?= $(shell go env GOARCH)

RELEASE_ARTIFACTS_DIR := .release_artifacts
CHECKSUM_FILE := checksums.txt

$(RELEASE_ARTIFACTS_DIR):
install -d $@

BUILDER_NAME := $(if $(BUILDER_NAME),$(BUILDER_NAME),$(shell git config user.name))
ifndef BUILDER_NAME
$(error "You must set environment variable BUILDER_NAME or set a user.name in your git configuration.")
Expand All @@ -25,7 +33,7 @@ ifndef EMAIL
$(error "You must set environment variable BUILDER_EMAIL or set a user.email in your git configuration.")
endif

BUILDER := $(shell echo "${NAME} <${EMAIL}>")
BUILDER := $(shell echo "${BUILDER_NAME} <${EMAIL}>")

PKG_RELEASE ?= 1
PROJECT_URL := "https://github.com/mrtazz/$(NAME)"
Expand All @@ -46,7 +54,7 @@ INSTALLED_TARGETS = $(addprefix $(PREFIX)/bin/, $(TARGETS))
INSTALLED_MAN_TARGETS = $(addprefix $(PREFIX)/share/man/man1/, $(MAN_TARGETS))

%: cmd/%/main.go
go build -ldflags "$(LDFLAGS)" -o $@ $<
GOOS=$(BUILD_GOOS) GOARCH=$(BUILD_GOARCH) go build -ldflags "$(LDFLAGS)" -o $@ $<

%.1: man/man1/%.1.md
sed "s/REPLACE_DATE/$(BUILDDATE)/" $< | pandoc -s -t man -o $@
Expand Down Expand Up @@ -129,10 +137,15 @@ deb: $(SOURCES)
--vendor mrtazz \
usr

.PHONY: build-standalone
build-standalone: all $(RELEASE_ARTIFACTS_DIR)
mv checkmake.1 $(RELEASE_ARTIFACTS_DIR)
mv checkmake $(RELEASE_ARTIFACTS_DIR)/checkmake-$(VERSION).$(BUILD_GOOS).$(BUILD_GOARCH)
cd $(RELEASE_ARTIFACTS_DIR) && shasum -a 256 checkmake-$(VERSION).$(BUILD_GOOS).$(BUILD_GOARCH) >> $(CHECKSUM_FILE)

.PHONY: github-release
github-release:
gh release create $(VERSION) --title 'Release $(VERSION)' --notes-file docs/releases/$(VERSION).md $(NAME)_$(VERSION)-$(PKG_RELEASE)_amd64.deb $(NAME)-$(VERSION)-$(PKG_RELEASE).x86_64.rpm

gh release create $(VERSION) --title 'Release $(VERSION)' --notes-file docs/releases/$(VERSION).md $(RELEASE_ARTIFACTS_DIR)/*


# clean up tasks
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ There are packages for linux up [on packagecloud.io](https://packagecloud.io/mrt
To build checkmake you will need to have [golang](https://golang.org/) installed. Once you have Go installed, you can simply clone the repo and build the binary and man page yourself with the following commands.

```sh
go get github.com/mrtazz/checkmake
cd "$GOPATH"/src/github.com/mrtazz/checkmake
git clone https://github.com/mrtazz/checkmake
cd checkmake
make
```

Expand Down
10 changes: 7 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
module github.com/mrtazz/checkmake

go 1.13
go 1.17

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docopt/docopt-go v0.0.0-20141128170934-854c423c8108
github.com/go-ini/ini v1.11.0
github.com/olekukonko/tablewriter v0.0.0-20150822215231-b9346ac189c5
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.1.4-0.20160615092844-d77da356e56a
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/smartystreets/goconvey v1.7.2 // indirect
)
13 changes: 13 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,22 @@ github.com/docopt/docopt-go v0.0.0-20141128170934-854c423c8108 h1:WJse1njqIlgvQj
github.com/docopt/docopt-go v0.0.0-20141128170934-854c423c8108/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
github.com/go-ini/ini v1.11.0 h1:EDp2zFK6TR11mvDrWDask1bXLBUgqbIqG4R6Lq3EoKI=
github.com/go-ini/ini v1.11.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/olekukonko/tablewriter v0.0.0-20150822215231-b9346ac189c5 h1:ZxRrPRTX45eVRfhXfZUgH1MG173pWRdOMFsnJoTaxwU=
github.com/olekukonko/tablewriter v0.0.0-20150822215231-b9346ac189c5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs=
github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg=
github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM=
github.com/stretchr/testify v1.1.4-0.20160615092844-d77da356e56a h1:UWu0XgfW9PCuyeZYNe2eGGkDZjooQKjVQqY/+d/jYmc=
github.com/stretchr/testify v1.1.4-0.20160615092844-d77da356e56a/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
8 changes: 8 additions & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
# github.com/davecgh/go-spew v1.1.1
## explicit
github.com/davecgh/go-spew/spew
# github.com/docopt/docopt-go v0.0.0-20141128170934-854c423c8108
## explicit
github.com/docopt/docopt-go
# github.com/go-ini/ini v1.11.0
## explicit
github.com/go-ini/ini
# github.com/olekukonko/tablewriter v0.0.0-20150822215231-b9346ac189c5
## explicit
github.com/olekukonko/tablewriter
# github.com/pmezard/go-difflib v1.0.0
## explicit
github.com/pmezard/go-difflib/difflib
# github.com/smartystreets/goconvey v1.7.2
## explicit; go 1.16
# github.com/stretchr/testify v1.1.4-0.20160615092844-d77da356e56a
## explicit
github.com/stretchr/testify/assert
github.com/stretchr/testify/require

0 comments on commit 0416c97

Please sign in to comment.