Skip to content

Commit

Permalink
Add github actions (#12)
Browse files Browse the repository at this point in the history
* Add github actions #9

* Update steps

* Fig coverage flags

* Exclude examples from coverage
  • Loading branch information
hedhyw authored Mar 24, 2022
1 parent 6649e80 commit 8da0924
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 23 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: check-gherkingen

on: [pull_request]

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.17.8'
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Build
run: make build

- name: Lint
run: make lint

- name: Check generate
run: make check.generate

- name: Test
run: make test

- uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.out
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: release-gherkingen

on:
push:
tags:
- "*"

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.17.8'

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}

docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm/v6,linux/386
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/gherkingen:latest,${{ secrets.DOCKERHUB_USERNAME }}/gherkingen:${{ steps.vars.outputs.tag }}
64 changes: 64 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
build:
binary: gherkingen
main: ./cmd/gherkingen
goos:
- windows
- darwin
- linux
goarch:
- "386"
- amd64
- arm
- arm64
goarm:
- "6"
ignore:
- goos: darwin
goarch: "386"
env:
- CGO_ENABLED=0

gomod:
proxy: true

archives:
- name_template: "{{.Binary}}_{{.Os}}_{{.Arch}}"
files:
- README.md
- LICENSE
format_overrides:
- goos: windows
format: zip

release:
draft: true

snapshot:
name_template: "{{.Tag}}"

checksum:
name_template: "task_checksums.txt"

nfpms:
- vendor: Task
homepage: https://github.com/hedhyw/gherkingen
maintainer: Maksym Kryvchun <[email protected]>
description: BDD tests boilerplate generator for Golang
license: MIT
formats:
- deb
- rpm
file_name_template: "{{.ProjectName}}_{{.Os}}_{{.Arch}}"

brews:
- name: gherkingen
description: BDD tests boilerplate generator for Golang
license: MIT
homepage: https://github.com/hedhyw/gherkingen
folder: Formula
tap:
owner: hedhyw
name: homebrew-tap
test: system "#{bin}/gherkingen", "-help"
install: |-
bin.install "gherkingen"
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

File renamed without changes.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
GOLANG_CI_LINT_VER:=v1.45.0
OUT_BIN?=${PWD}/bin/gherkingen
COVER_PACKAGES=${go list ./... | grep -Ev 'examples' | tr '\n' ','}

build:
go build -o ${OUT_BIN} cmd/gherkingen/main.go
Expand All @@ -10,7 +11,8 @@ lint: bin/golangci-lint
.PHONY: lint

test:
go test -covermode=count -coverprofile=coverage.out ./...
go test -coverpkg=github.com/hedhyw/gherkingen/internal/app -covermode=count -coverprofile=coverage.out ./...
go tool cover -func=coverage.out
.PHONY: test

generate:
Expand Down
File renamed without changes.

0 comments on commit 8da0924

Please sign in to comment.