diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..2986d4e --- /dev/null +++ b/.github/workflows/check.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6fb1bbe --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..f96e4f7 --- /dev/null +++ b/.goreleaser.yml @@ -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 + 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" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index be6e387..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: go - -go: -- "1.17.8" - -git: - depth: 1 - -notifications: - email: false - -jobs: - include: - - stage: lint - script: make lint - - stage: test - script: make test - - stage: generate - script: make check.generate - - before_install: go install github.com/mattn/goveralls@v0.0.11 - script: $GOPATH/bin/goveralls -service=travis-ci -repotoken $COVERALLS_TOKEN - if: branch = main \ No newline at end of file diff --git a/License b/LICENSE similarity index 100% rename from License rename to LICENSE diff --git a/Makefile b/Makefile index 6258080..5490055 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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: diff --git a/Readme.md b/README.md similarity index 100% rename from Readme.md rename to README.md